n,LAUSANNE,Applied Mathematics
> Cc: r-help@r-project.org
> Subject: Re: [R] Replacing values in a data.frame/matrix
>
> how about:
>
> m <- matrix(c(1,2,3,2,1,3,3,1,2), ncol = 3, byrow = TRUE)
> perm <- c(1, 3, 2)
>
> out <- perm[m]
> dim(out) <- dim(m)
how about:
m <- matrix(c(1,2,3,2,1,3,3,1,2), ncol = 3, byrow = TRUE)
perm <- c(1, 3, 2)
out <- perm[m]
dim(out) <- dim(m)
out
I hope it helps.
Best,
Dimitris
On 3/8/2011 4:05 PM, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote:
Hi all,
Suppose we have the following matrix
m<- matrix(c
2 matches
Mail list logo