[R] Error in apply(x2, 1, diff) : dim(X) must have a positive length
hithit168
ccchristy at live.com
Mon Feb 13 01:05:12 CET 2012
Anyone knows hat might be the cause of this error? Thanks for any help!
>library(MASS)
> dif.mns = function(x2,tr1=.2,tr2=.3){
+ #generates four different 'means' using
+ #difference scores from x2, an n x 2 matrix
+ #for use w/ bootstrap comparisons
+ diffs = apply(x2,1,diff)
+ mn1=mean(diffs)
+ mn2=mean(diffs,tr=.2)
+ mn3=mean(diffs,tr=.3)
+ mn4=median(diffs)
+ mns=c(mn1,mn2,mn3,mn4)
+ list(mnds=round(mns,3)) }
> dif.mns(shoes)
Error in apply(x2, 1, diff) : dim(X) must have a positive length
--
View this message in context: http://r.789695.n4.nabble.com/Error-in-apply-x2-1-diff-dim-X-must-have-a-positive-length-tp4382435p4382435.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list