Skip to content

Commit

Permalink
Fix .onLoad function (hack)
Browse files Browse the repository at this point in the history
Apparently requiring methods and then calling methods::setRefClass
within the .onLoad function causes reference classes to start working.

The require statement is hidden in a string to avoid a warning in "R CMD check"
  • Loading branch information
DarwinAwardWinner committed May 15, 2013
1 parent 7461555 commit 6087e62
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
.onLoad <-
function(libname, pkgname)
{
## This function fails without the following two lines. Not sure why.
eval(parse(text="require(methods)"))
A <- methods::setRefClass("A")

## only SnowParam on widows, which is then the default (first)
register(getOption("SnowParam", SnowParam(workers=detectCores())))
if (.Platform$OS.type != "windows")
Expand Down

0 comments on commit 6087e62

Please sign in to comment.