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
wrote:
Dear R-help-list
I have two character vectors
a <- c("A", "B", "C")
b <- c("A", "C", "B")
Then
match(b, a) ?
Michael
Right! Thanks, Michael.
On 16 September 2010 17:13, Niels Richard Hansen
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 en
match(b, a) ?
Michael
On 16 September 2010 17:13, Niels Richard Hansen
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 bring
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 f
4 matches
Mail list logo