Hello,

I would like to be able to update an existing column in a dataframe, like this...

data$score[data$type=="1" & data$year=="2001"]<-data$score * 0.111
data$score[data$type=="1" & data$year=="2002"]<-data$score * 0.222
data$score[data$type=="1" & data$year=="2003"]<-data$score * 0.333

...but, if possible, using simpler code. I've got several dozen lines of code like this (type 2, type3, etc. for the same years) so it would be great if I could reduce each set of three lines of code to one line

Any help much appreciated, thanks!

Mark

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to