lamack lamack wrote:
> Dear all, Why the transform function does not accept two statistics
> functions?
>
> a = data.frame(matrix(rnorm(20),ncol=2))
>
> transform(a,M.1=mean(X1),M.2=mean(X2)) # does not works
>
> #while:
>
> transform(a,M.1=mean(X1),M2=log(abs(X2))) #works
>
>
It's a variation of this effect:
data.frame(airquality, list(x=1))#works
data.frame(airquality, list(x=1, y=2)) #works not
Not quite sure what the logic of that is
Of course transform() isn't really intended to handle anything but
transformed vectors of the same length as the original.
__
R-help@stat.math.ethz.ch 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.