[R] Select just numeric values from rows

Pete Brecknock Peter.Brecknock at bp.com
Thu Feb 3 02:57:46 CET 2011


Terry

Any good?

list <-"A B C N1 N2 N3 N4 N5 N6 N7 N8 N9 N10
Apples  Bananas  Peaches  1  2  3  4  5  6  7  8  9  10
Oranges  Kumquats  Plums  1  1  3  5  5  5  7  6  6  12
Pears  Kiwis  Grapes  2  4  6  8  5  6  7  6  9  1"

d = read.table(textConnection(list), header=TRUE)

Nrowsums = apply(d[,sapply(d,is.numeric)],1,sum)

HTH

Pete
-- 
View this message in context: http://r.789695.n4.nabble.com/Select-just-numeric-values-from-rows-tp3256237p3256670.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list