On Feb 12, 2012, at 7:05 PM, hithit168 wrote:
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
You have given apply a list.
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org 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.