[R] mean and sd with number of values?
Erik Iverson
iverson at biostat.wisc.edu
Thu Mar 6 17:51:21 CET 2008
Martin -
Does the following help?
sapply(fl, function(x) sum(!is.na(x)))
See ?sapply
Best,
Erik Iverson
Martin Kaffanke wrote:
> Hi there,
>
> When i do
>
> mean(fl[1:20], na.rm=T)
> sd(fl[1:20], na.rm=T)
>
> I get 20 Results, but now I'd like to know from how many numbers my mean
> and sd are calculated.
>
> How to I use the length() for this, or is this possible?
>
> Because there are missing values in some, but not in all columns. So
> there should be a different count of numbers.
>
> Thanks,
> Martin
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list