Calculating the mean in one column with empty cells
Hi see inline
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- project.org] On Behalf Of fxen3k Sent: Friday, October 05, 2012 11:28 AM To: r-help at r-project.org Subject: [R] Calculating the mean in one column with empty cells Hi all, I recently tried to calculate the mean and the median just for one column. In this column I have numbers with some empty cells due to missing data. So how can I calculate the mean just for the filled cells? I tried: mean(dataSet2$ac_60d_4d_after_ann[!is.na(master$ac_60d_4d_after_ann)], na.rm=TRUE)
mean(dataSet2$ac_60d_4d_after_ann, na.rm=TRUE) shall suffice. But the output was different to the calculation I died in Microsoft
Excel.
Hm. I am also sometimes dying from Excel performance. There could be 2 options: Excel is wrong You did not have transferred values from Excel to R correctly, they are screwed somehow. Which one is true is difficult to decide based on information you revealed. Regards Petr
Thanks in advance, Felix -- View this message in context: http://r.789695.n4.nabble.com/Calculating-the-mean-in-one-column-with- empty-cells-tp4645135.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.