42469

Websockets service method fails during R startup

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

Answer1:

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.

Recommend

  • Solid border or dotted border? When to use which?
  • SQL: Inserting row for missing month(s)
  • Select Distinct Element into a node XSLT
  • R Rvest for() and Error server error: (503) Service Unavailable
  • Go - modify dereferenced struct pointer changes most struct values, but not slices
  • Labels not displaying on D3 donut chart
  • What ever happend to the d3j.s force directed graph cluster example see on this image?
  • Java - Convert Big-Endian to Little-Endian
  • With haskell's turtle library, how to extract filename as String from FilePath?
  • How to get smooth mouse events for a canvas “drawing style” app?
  • Getting data from matplotlib axes object
  • Hiding a tab in a Spark TabBar
  • d3: Optionally add child elements based on node content in force layout
  • How to change display text in item template based on eval in gridview?
  • how to make vpython .exe using pyinstaller
  • How to pass a value from ASP.NET MVC controller to ASP.NET webforms control inside MVC View?
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • Access variable of ScriptContext using Nashorn JavaScript Engine (Java 8)
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Nant, Vault & Windows Integrated Authentication
  • Counter field in MS Access, how to generate?
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Javascript + PHP Encryption with pidCrypt
  • Build own AppleScript numerical error handling
  • Google cloud sdk not working when python points python3
  • Is there a mandatory requirement to switch app.yaml?
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?