[R] Logical test and look up table
Nikola MARKOV
markov at lyon.inserm.fr
Sun Jan 20 02:57:14 CET 2008
Dear R users,
I have a data frame with one column (4000 rows) containing name codes
(factor with 63 levels). I would like to associate each name with a
particular Type (coded as 1,2,3,4,H or H1) in a second column. Is it
possible to do a lookup table of associations (i.e. A23 is of type 1, A13
is of type 3 ...) so as to fill up automatically the $Type column.
df()
$Source $Type
A23
A24
A9
A32
A25
A14
A10
A12
A11
A13
G
Alternative solutions are also welcome.
Thanks in advance
P.S. I found a discussion mentioning match() and %in% but it does not seem
adapted.
--
Nikola Markov
Inserm U 846 Stem cells and brain research institute
18 av Du Doyen Lepine
69500 Bron
France
More information about the R-help
mailing list