[R] How to replace values?

Sigbert Klinke sigbert at wiwi.hu-berlin.de
Thu Apr 30 12:51:00 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

If the coding would start at 1 rather than 0 then +1's in the
penultimate line could be eliminated.

Sigbert

- ---

gene <- c("YAR003W", "YAR007C", "YAR008W", "YBL035C", "YBL111C", "YBL112C")
print(gene)
to   <- c(0,1,3,2)             # to   <- c(1,2,4,3)
from <- c(1,5,4,3)             # from <- c(2,6,5,4)
gene[to+1] <- gene[from+1]     # gene[to] <- gene[from]
print(gene)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFJ+YKUWvYUYQkj1zkRAjlVAJ9NrHySXnFCUmyBS7XbBwgAeOu1XQCVHvCa
omPs62LERNyQJ/+I9uL52g==
=seex
-----END PGP SIGNATURE-----




More information about the R-help mailing list