[R] How use lapply over one column in a dataframe?

Robert Nicholson robert.nicholson at gmail.com
Mon Apr 26 15:14:18 CEST 2010

So I have Transactions as a dataframe and Transactions$Symbol is a column in the frame

I simply want to run sub over all elements in that column where the new value replaces the old value

this doesn't seem to work

Transactions$Symbol = lapply(Transactions$Symbol, function(x) sub('[ -]*','INST',x))
> Transactions$Symbol

More information about the R-help mailing list