[R] Equivalent to apply(x[,2:5],1,sum) for dataframe

Agustin Lobo aloboaleu at gmail.com
Fri Nov 21 18:17:01 CET 2008


What's the most correct way of doing the equivalent to
apply(x[,2:5],1,sum)

if x is dataframe in which the only numeric fields are
in columns 2:5 ?
(using apply returns a character vector)

Thanks

Agus

-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster



More information about the R-help mailing list