Dear R-help-list
I have two character vectors
a - c(A, B, C)
b - c(A, C, B)
Then
sapply(a, function(i) grep(i, b))
computes the permutation of the entries in 'b' needed
to bring 'b' into the same order as 'a'.
I have searched around, but haven't been able to find
any existing function that
match(b, a) ?
Michael
On 16 September 2010 17:13, Niels Richard Hansen
niels.r.hansen+li...@math.ku.dk wrote:
Dear R-help-list
I have two character vectors
a - c(A, B, C)
b - c(A, C, B)
Then
sapply(a, function(i) grep(i, b))
computes the permutation of the entries in 'b' needed
to
match(b, a) ?
Michael
Right! Thanks, Michael.
On 16 September 2010 17:13, Niels Richard Hansen
niels.r.hansen+li...@math.ku.dk wrote:
Dear R-help-list
I have two character vectors
a - c(A, B, C)
b - c(A, C, B)
Then
sapply(a, function(i) grep(i, b))
computes the permutation of
On Sep 16, 2010, at 4:23 AM, Michael Bedward wrote:
match(b, a) ?
Or just order(.) :
b[order(a)]
[1] A C B
--
David
Michael
On 16 September 2010 17:13, Niels Richard Hansen
niels.r.hansen+li...@math.ku.dk wrote:
Dear R-help-list
I have two character vectors
a - c(A, B, C)
b - c(A,
4 matches
Mail list logo