Tirsdag 17. februar 2015 15.50.27 skrev David Winsemius:
On Feb 17, 2015, at 3:58 AM, Knut Hansen wrote:
Dear list,
I have a vector:
my.vector - c(A, B, C, D, E, F, G)
and two other:
vec1 - c(p, q, r, s, t)
vec2 - c(x, y, z)
I want to substitute elements b and e in
On Feb 17, 2015, at 3:58 AM, Knut Hansen wrote:
Dear list,
I have a vector:
my.vector - c(A, B, C, D, E, F, G)
and two other:
vec1 - c(p, q, r, s, t)
vec2 - c(x, y, z)
I want to substitute elements b and e in my.vector with vectors vec1 and
vec2 respectively so that the result
Hi,
Here is an implementation.
my.vector
[1] A B C D E F G
vec1
[1] p q r s t
vec2
[1] x y z
final - as.character(unlist(sapply(my.vector,function(x)
if(x==B){vec1}else{if(x==E){vec2}else{x}})))
final
[1] A p q r s t C D x y z F G
--
View this message in context:
Dear list,
I have a vector:
my.vector - c(A, B, C, D, E, F, G)
and two other:
vec1 - c(p, q, r, s, t)
vec2 - c(x, y, z)
I want to substitute elements b and e in my.vector with vectors vec1 and
vec2 respectively so that the result becomes the vector:
c(A, p, q, r , s , t, C , D, x, y, z, F, G)
On 17-02-2015, at 12:58, Knut Hansen knut.han...@uit.no wrote:
Dear list,
I have a vector:
my.vector - c(A, B, C, D, E, F, G)
and two other:
vec1 - c(p, q, r, s, t)
vec2 - c(x, y, z)
I want to substitute elements b and e in my.vector with vectors vec1 and
vec2 respectively so
5 matches
Mail list logo