[R] DataFrame help

voidobscura nshah171 at gmail.com
Thu Jul 16 20:25:50 CEST 2009


Alright, so I am trying to write my own function to calculate column sums in
a matrix.  I want the result as a single list with the values.

So far I have:

csum<-function(m)
{
	a = data.frame(m)
	s = lapply(a,sum)
	return(s)
}

What is the easiest way to have it return in a format such as [1] 6 15 24 ?

Thanks.
-- 
View this message in context: http://www.nabble.com/DataFrame-help-tp24521881p24521881.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list