[R] replace values

syrvn mentor_ at gmx.net
Sat Dec 3 14:41:07 CET 2011


Hello,


imagine the following data.frame:

ID name
1 *_A
2 *_A
3 *_B
4 *_B

* = can be any pattern

I want to replace every row which ends with _A by 1 and every row which ends
by _B with a 0

so that the data.frame looks like the following:

ID name
1 1
2 1
3 0
4 0


Which function do I use best to achieve this?

Cheers,
Syrvn



--
View this message in context: http://r.789695.n4.nabble.com/replace-values-tp4153301p4153301.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list