> str(time) function (x, ...) > str(t_p1) num [1:576] 190 180 190 200 210 200 220 190 230 230 ... > str(Baseline.integrated) Factor w/ 2 levels "Baseline","Integrated": 1 1 1 1 1 1 1 1 1 1 ... > str(Technique) Factor w/ 2 levels "Barrel","NonPrefHand": 1 1 1 1 1 1 1 1 1 1 ... > str(Grip) Factor w/ 2 levels "Round","Tripod": 1 1 1 1 1 1 1 1 1 1 ...
On Fri, May 22, 2009 at 2:46 PM, jim holtman <jholt...@gmail.com> wrote: > You need to supply str for the original arguments; the error message had a > different set of parameters. > > > On Fri, May 22, 2009 at 2:36 PM, Thomas Levine <thomas.lev...@gmail.com>wrote: > >> That produces the following error >> >> > tapply(t_p1,list(Grip,Technique),truecost) >> Error in tapply(time, Baseline.integrated, mean, na.rm = T) : >> arguments must have same length >> >> >> >> >> On Fri, May 22, 2009 at 1:06 PM, jim holtman <jholt...@gmail.com> wrote: >> >>> Error message is self-explanatory: there is an unused parameter >>> 'na.rm=TRUE'. You are calling your function 'truecost' which only has a >>> single parameter 'time' and you are attempting to pass in 'na.rm=TRUE' which >>> it will not accept. You don't need it. >>> >>> On Fri, May 22, 2009 at 12:36 PM, Thomas Levine < >>> thomas.lev...@gmail.com> wrote: >>> >>>> A subset of my raw data looks like this: >>>> >>>> -------------- >>>> "Grip" "Technique" "Baseline.integrated" "Task" >>>> "Stroke..direction." "Engag" "Disen" >>>> "PenDG" "PenUG" "PenDS" >>>> "PenUS" "Duration" >>>> ------------- >>>> "Tripod","Barrel","Integrated",7,"S70",230,510,270,510,781,1011,1011 >>>> >>>> "Tripod","Barrel","Integrated",7,"S71","na","na","na","na","na","na","na" >>>> "Round","NonPrefHand","Baseline",0,"S00","na","na",110,250,380,520,520 >>>> "Round","NonPrefHand","Baseline",0,"S01","na","na",220,360,460,620,620 >>>> -------------- >>>> >>>> >>>> I computed some values (times) from the raw data >>>> >>>> >>>> --------------- >>>> t_p1=PenDG >>>> t_c1=PenUG-PenDG >>>> t_p2=PenDS-PenUG >>>> t_c2=PenUS-PenDS >>>> --------------- >>>> >>>> >>>> And I put those times in a data frame called "times". For each of these >>>> times, I want to subtract the average for "Baseline" trials from the >>>> average >>>> for "Integrated" trials within the "Grip" and "Technique" factors. Call >>>> these differences the true cost of mode selection. >>>> >>>> >>>> > truecost <- >>>> >>>> function(time){as.numeric(tapply(time,Baseline.integrated,mean,na.rm=T)[2]-tapply(time,Baseline.integrated,mean,na.rm=T)[1])} >>>> >>>> To help explain what the truecost function does: >>>> > tapply(t_p1,Baseline.integrated,mean,na.rm=T) >>>> Baseline Integrated >>>> 212.8000 252.8402 >>>> > truecost(t_p1) >>>> [1] 40.04021 >>>> >>>> >>>> Then I try to create a table of average truecost as a function of levels >>>> of >>>> a factor. I think this is the same error with tapply and by. >>>> >>>> >>>> > tapply(t_p1,list(Grip,Technique),truecost,na.rm=T) >>>> Error in FUN(X[[1L]], ...) : unused argument(s) (na.rm = TRUE) >>>> > by(times,list(Grip,Technique),truecost,na.rm=T) >>>> Error in FUN(data[x, , drop = FALSE], ...) : >>>> unused argument(s) (na.rm = TRUE) >>>> >>>> >>>> Any ideas? >>>> >>>> >>>> Thomas Levine! >>>> >>>> [[alternative HTML version deleted]] >>>> >>>> ______________________________________________ >>>> 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<http://www.r-project.org/posting-guide.html> >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >>> >>> >>> -- >>> Jim Holtman >>> Cincinnati, OH >>> +1 513 646 9390 >>> >>> What is the problem that you are trying to solve? >>> >> >> > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > [[alternative HTML version deleted]] ______________________________________________ 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.