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?

        [[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.

Reply via email to