Odp: mean and sd with number of values?
Am Donnerstag, den 06.03.2008, 17:47 +0100 schrieb Petr PIKAL:
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]))
This seems to give me a sum of all the items. But I'd like to have it per column.
mean(fl[1:20])
aids angststoer autismus bauchspduekrebs
prostata
-0.7474884 -1.0475500 -0.6267267 NA
-1.7318179
fraudep manndep hautkrebs herzinfarkt
leukaemie
-1.2919841 -1.5124280 -0.3202036 -0.8246589
0.7550549
lungenkrebs manischdepresiv magenkrebs magersucht
mannmagsucht
-1.2451753 -1.9726160 1.4548394 -0.6242250
NA
osteoporose panik schizophrenie schlaganfall
zwangsstoer
-1.7974270 NA -1.8634089 NA
-1.5056106
mean(fl[1:20], na.rm=T)
aids angststoer autismus bauchspduekrebs
prostata
-0.7474884 -1.0475500 -0.6267267 1.2168804
-1.7318179
fraudep manndep hautkrebs herzinfarkt
leukaemie
-1.2919841 -1.5124280 -0.3202036 -0.8246589
0.7550549
lungenkrebs manischdepresiv magenkrebs magersucht
mannmagsucht
-1.2451753 -1.9726160 1.4548394 -0.6242250
-0.3765245
osteoporose panik schizophrenie schlaganfall
zwangsstoer
-1.7974270 -1.2328361 -1.8634089 -1.7165059
-1.5056106
sum(!is.na(fl[1:20]))
[1] 892 So I'd like to have it like the mean, to see how many data is calculated by na.rm=T per column? Thanks, Martin -------------- 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/2a1ffaa9/attachment.bin