Re: [R] How to update a column in a dataframe, more simply...

2008-09-26 Thread jim holtman
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

[R] How to update a column in a dataframe, more simply...

2008-09-26 Thread Mark Na
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 ...