[R] Function not found, maybe respective package has to be put in environment?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Nov 13 20:17:15 CET 2011


You have to load tseries on the nodes, not only on the master, i.e.:

clusterEvalQ(cl, library("tseries"))

Best,
Uwe Ligges



On 13.11.2011 19:34, Andreas Klein wrote:
> Hello everybody,
>
> I have a problem and would like to start with an example:
>
> library(snow)
> library(tseries)
> fn<- function(x) adf.test(x)
>
> clusterApply(cl=cl, x=x , fun=fn)
>
>
> R cannot find the function adf.test() because it is inside the function fn(). This problem does not occur when, for example, fn<- function(x) mean(x) holds. Therefore, I think the package tseries has to be put somehow in the environment where also the package stats is because the function mean() works but the function adf.test() not.
>
> But how to solve the problem?
>
> Remark:
> The above code is an example to illustrate my problem. My original function is more complex and somewhere inside my function I refer to some other function from the package tsDyn.
>
>
> I hope you can help me.
>
> Kind regards,
> Andy.
>
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list