I would like to run websockets inside R when R is starts up. I use websockets package: http://cran.r-project.org/web/packages/websockets/. If I run the example from this distribution on Windows by setting follow in Rprofile.site:
.First <- function()
{
source("C:\\R\\orig-websockets.R")
}
I'm getting follow error:
Error in .parse_header(x) : could not find function "tail"
Trace is follow:
6: .parse_header(x)
5: service(w) at orig-websockets.R#26
4: eval.with.vis(expr, envir, enclos)
3: eval.with.vis(ei, envir)
2: source("C:\\R\\orig-websockets.R")
1: .First()
I assume the problem in some package dependencies. Same script works fine if loaded manually.
Thank you in advance.
Ilya
tail is in the utils package. You need to add require("utils") either to the .First function before you source the script or at the top of the script.
From ?Startup
... if a function .First is found on the search path, it is executed as .First(). Finally, function .First.sys() in the base package is run. This calls require to attach the default packages specified by options("defaultPackages").
In other words, utils isn't loaded until after the .First function has been executed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With