[R] How to add a variable to a dataframe whose values are conditional upon the values of an existing variable

David Freedman 3.14david at gmail.com
Sat Feb 27 22:06:26 CET 2010


there's a recode function in the Hmisc package, but it's difficult (at least
for me) to find documentation for it

library(Hmisc)
week <- c('SAT', 'SUN', 'MON', 'FRI');
recode(week,c('SAT', 'SUN', 'MON', 'FRI'),1:4)

HTH
-- 
View this message in context: http://n4.nabble.com/How-to-add-a-variable-to-a-dataframe-whose-values-are-conditional-upon-the-values-of-an-existing-vare-tp1571214p1572261.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list