Skip to content
Prev 359172 / 398502 Next

replace text in table R?

Here's an lapply approach that gives the same result (complete with the misspelling of 'assigned':

dat1[3:5] <- lapply(dat1[3:5], function(x) dat2$To.be.assinged[ match( x, dat2$site) ])
dat1

`match` is designed for generating selection vectors and does not need preceding calls to as.character for factors.

--
Best;
David.
David Winsemius
Alameda, CA, USA