Re: [R] by gives no results, gives warning that data are non-numeric, but the data appears to be numeric.

2015-12-28 Thread John Sorkin
Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone)

Re: [R] by gives no results, gives warning that data are non-numeric, but the data appears to be numeric.

2015-12-27 Thread Rolf Turner
You are trying to take the mean of data frames. There is no "data.frame" method for mean(). Try: by(hold,Arm,function(x){sapply(x,mean)}) BTW what's the point of "na.rm=TRUE" in your call? There are no missing values in the data that you present. In future, please use dput() to

[R] by gives no results, gives warning that data are non-numeric, but the data appears to be numeric.

2015-12-27 Thread John Sorkin
When I run by, I get an error message and no results. Any help in understanding what is wrong would be appreciated. Error message: Warning messages: 1: In mean.default(data[x, , drop = FALSE], ...) : argument is not numeric or logical: returning NA 2: In mean.default(data[x, , drop = FALSE],

Re: [R] by gives no results, gives warning that data are non-numeric, but the data appears to be numeric.

2015-12-27 Thread John Sorkin
Rolf, Thank you! John > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore,

Re: [R] by gives no results, gives warning that data are non-numeric, but the data appears to be numeric.

2015-12-27 Thread William Dunlap via R-help
by(dataFrame, groupId, FUN) applies FUN a bunch of data.frames (row subsets of the dataFrame input). mean() returns NA for data.frames. You could use FUN=colMeans if you wanted column means or FUN=function(x)mean(colMeans(x)) or FUN=function(x)mean(unlist(x)) if you wanted some version of a