Dear R-help folks,
I am seeing unexpected behaviour from the function mean
with option na.rm =TRUE (which is removing a whole column of a data frame
or matrix.
example:
testcase - data.frame( x = 1:3, y = rep(NA,3))
mean(testcase[,1], na.rm=TRUE)
[1] 2
mean(testcase[,2], na.rm = TRUE)
[1] NaN
Jim Robison-Cox wrote:
Dear R-help folks,
I am seeing unexpected behaviour from the function mean
with option na.rm =TRUE (which is removing a whole column of a data frame
or matrix.
example:
testcase - data.frame( x = 1:3, y = rep(NA,3))
mean(testcase[,1], na.rm=TRUE)
[1] 2
Jim Robison-Cox [EMAIL PROTECTED] writes:
Summary:
If I have a data frame or a matrix where one entire column is NA's,
mean(x, na.rm=T) works on that column, returning NaN, but fails using
apply, in that apply returns NA for ALL columns.
lapply works fine on the data frame.
If you
On Mon, 13 Jun 2005 11:05:46 -0600 (MDT) Jim Robison-Cox wrote:
Dear R-help folks,
I am seeing unexpected behaviour from the function mean
with option na.rm =TRUE (which is removing a whole column of a data
frame or matrix.
example:
testcase - data.frame( x = 1:3, y = rep(NA,3))
In
I see.
So apply() first changes the dataframe to a matrix, which made it
a matrix of text values, then mean made no sense for any column, so I got
all NA's.
Thanks, Peter,
Jim
On 13 Jun 2005, Peter Dalgaard wrote:
Jim Robison-Cox [EMAIL PROTECTED] writes:
Summary:
If I have a data