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 -- Ihr Partner f?r Webdesign, Webapplikationen und Webspace. http://www.roomandspace.com/ Martin Kaffanke +43 650 4514224 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Dies ist ein digital signierter Nachrichtenteil Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080306/c553c221/attachment.bin
Hi Martin, Try x=c(NA,NA,rnorm(50),NA) sum(!is.na(x)) HTH Jorge On Thu, Mar 6, 2008 at 11:41 AM, Martin Kaffanke <technik@roomandspace.com> 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 > > -- > Ihr Partner für Webdesign, Webapplikationen und Webspace. > http://www.roomandspace.com/ > Martin Kaffanke +43 650 4514224 > > ______________________________________________ > R-help@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. > >[[alternative HTML version deleted]]
Hi r-help-bounces at r-project.org napsal dne 06.03.2008 17:41:06:> Hi there, > > When i do > > mean(fl[1:20], na.rm=T)e.g. sum(!is.na(fl[1:20])) Regards Petr> 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 > > -- > Ihr Partner f?r Webdesign, Webapplikationen und Webspace. > http://www.roomandspace.com/ > Martin Kaffanke +43 650 4514224 > [p??loha signature.asc odstran?na u?ivatelem Petr PIKAL/CTCAP] > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
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.