Re: [R] tapply function with NA

2010-05-10 Thread Gabor Grothendieck
See ?colSums On Mon, May 10, 2010 at 12:44 AM, vincent.deluard vincent.delu...@trimtabs.com wrote: Hi R users, I have a matrix m of the type: m       X4.20.2010 X4.19.2010   X4.16.2010 [1,]  0.008319468 0. -0.008250825 [2,]  0.005574136 0.01816118  0.073081608 [3,] -0.047830688

[R] tapply function with NA

2010-05-09 Thread vincent.deluard
Hi R users, I have a matrix m of the type: m X4.20.2010 X4.19.2010 X4.16.2010 [1,] 0.008319468 0. -0.008250825 [2,] 0.005574136 0.01816118 0.073081608 [3,] -0.047830688 0.01612903 -0.030239833 [4,] NA NA NA [5,] 0.008746356 0.02848576

Re: [R] tapply function with NA

2010-05-09 Thread RICHARD M. HEIBERGER
It is exactly the same tmp - matrix(1:24,6,4) tmp[4,] - NA tmp apply(tmp, 2, sum, na.rm=TRUE) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] tapply function

2009-11-03 Thread FMH
Hi, I tried to use tapply function to find the mean of the data in each group as the following command, but the result are NA, as there are several missing values in each group. tapply(data,group,mean) Could someone please advice me the way to  ignore the missing data in order for the

Re: [R] tapply function

2009-11-03 Thread Sundar Dorai-Raj
you must have missing values in data. Try tapply(data, group, mean, na.rm = TRUE) If that's not the case, read the bottom of this email about the posting guide. HTH, --sundar On Tue, Nov 3, 2009 at 5:28 AM, FMH kagba2...@yahoo.com wrote: Hi, I tried to use tapply function to find the mean