Re: [R] Updating selected variables in a data frame

2008-03-17 Thread Gabor Grothendieck
Try this. It uses the fact that 2 column matrices can be used as subscripts (as described in the Matrices and arrays section of ?Extract): with(recodes, replace(as.matrix(main), cbind(id, qst + 1), value)) It returns a matrix so use as.data.frame on that to turn it back to a data frame, if need b

[R] Updating selected variables in a data frame

2008-03-17 Thread Andrew C. Ward
Dear list, I'd like to update certain rows/columns in a data frame with new values. The application is that survey respondents may give an answer of "Other" to a categorical question and then provide some text describing what they mean. This text is then reviewed and placed into a category. These