[R] lineplot.CI in "sciplot": option "ci.fun" can't be changed?

Tao Shi shitao at hotmail.com
Fri Apr 2 19:36:21 CEST 2010


hi List and Manuel,

I have encounter the following problem with the function "lineplot.CI".  I'm running R 2.10.1, sciplot 1.0-7 on Win XP.  It seems like it's a scoping issue, but I couldn't figure it out.

Thanks!

...Tao



> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth)    ## fine
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, fun=median)  ## fine
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, fun=mean)  ## fine
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, ci.fun= function(x) c(fun(x)-2*se(x), fun(x)+2*se(x)))  ## failed!
Error in FUN(X[[1L]], ...) : could not find function "fun"

> debug(lineplot.CI)
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, ci.fun= function(x) c(fun(x)-2*se(x), fun(x)+2*se(x)))
....
....
....
....
Browse[2]> 
debug: mn.data <- tapply(response, groups, fun)
Browse[2]> 
debug: CI.data <- tapply(response, groups, ci.fun)
Browse[2]> fun
function (x) 
mean(x, na.rm = TRUE)
<environment: 0x07178640>
Browse[2]> ci.fun
function(x) c(fun(x)-2*se(x), fun(x)+2*se(x))
Browse[2]> debug(ci.fun)
Browse[2]> fun
function (x) 
mean(x, na.rm = TRUE)
<environment: 0x07178640>
Browse[2]> 
debugging in: FUN(X[[1L]], ...)
debug: c(fun(x) - 2 * se(x), fun(x) + 2 * se(x))
Browse[3]> 
Error in FUN(X[[1L]], ...) : could not find function "fun"
> undebug(lineplot.CI)
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, ci.fun= function(x) c(fun(x)-se(x), fun(x)+se(x))) 
Error in FUN(X[[1L]], ...) : could not find function "fun"
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, fun = function(x) mean(x, na.rm=TRUE),ci.fun= function(x) c(fun(x)-se(x), fun(x)+se(x))) 
Error in FUN(X[[1L]], ...) : could not find function "fun"
> lineplot.CI(x.factor = dose, response = len, data = ToothGrowth, fun = function(x) median(x, na.rm=TRUE),ci.fun= function(x) c(fun(x)-se(x), fun(x)+se(x))) 
Error in FUN(X[[1L]], ...) : could not find function "fun"





 		 	   		  
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.

N:WL:en-US:WM_HMP:042010_1


More information about the R-help mailing list