[R] Applying a transformation to multiple data frame columns

2010-01-30 Thread Dimitri Shvorob
How can one simplify the folowing? t$aum[is.na(t$aum)] = 0; t$aum.core[is.na(t$aum.core)] = 0 t$num[is.na(t$num)] = 0; t$num.core[is.na(t$num.core)] = 0 Thank you. -- View this message in context:

Re: [R] Applying a transformation to multiple data frame columns

2010-01-30 Thread jim holtman
for (i in c('aum', 'num','aum.core','num.core')) t[[i]][is.na(t[[i]])] - 0 On Sat, Jan 30, 2010 at 3:34 PM, Dimitri Shvorob dimitri.shvo...@gmail.com wrote: How can one simplify the folowing? t$aum[is.na(t$aum)] = 0; t$aum.core[is.na(t$aum.core)] = 0 t$num[is.na(t$num)] = 0;

Re: [R] Applying a transformation to multiple data frame columns

2010-01-30 Thread Brad Patrick Schneid
look at plyr package colwise (column wise) function -- View this message in context: http://n4.nabble.com/Applying-a-transformation-to-multiple-data-frame-columns-tp1457641p1457666.html Sent from the R help mailing list archive at Nabble.com. __