First of all, what you have will not work since you also have to
subset the RHS of the equation:
data$score[data$type=="1" &
data$year=="2001"]<-data$score[data$type=="1" & data$year=="2001"] *
0.111
Another way is to construct a matrix of the values you want to search
for and change: (not tested
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
...
2 matches
Mail list logo