[R] by function error

苏文龙 814057409 at qq.com
Thu Apr 20 02:17:22 CEST 2017

hi, I practice R programing by the step in <<R In Action>>; 
when i test by function, i get error like these;
call for help!

dstats <- function(x){c(mean=mean(x), sd=sd(x))}
> by(mtcars[,c('mpg', 'hp')], mtcars$am, dstats)
 Show Traceback
 Rerun with Debug
 Error in is.data.frame(x) : 
  (list) object cannot be coerced to type 'double'

 Su Wenlong
	[[alternative HTML version deleted]]

More information about the R-help mailing list