[datatable-help] data.table packaged code throws error

AdamMarczak adam.marczak at gmail.com
Mon Jan 2 09:24:43 CET 2012


Dear All,

I have created code that successfully runs 100% of time. When a new session
is started and I source code like:

source('C:/path/to/my/code/myScript.R');

And then call function

myFunction();

It runs successfuly

but when I package code using below code
 
package.skeleton( 
    name = "mgrpoc", 
    code_files = 'C:/path/to/my/code/myScript.R', 
    path = "'C:/path/to/my/code/'" 
) 

and check package using CHECK utility I got message
"myFunction: no visible binding for global variable 'consumption'"

Where consumption is one of data.table columns used in code as follows
dt <- data.table(myTable);
sumByGroup <- dt[,myValidation(consumption, othercolumn),
by=list(dt$column)]

And so I package code using command
C:/R/R.14-1/bin/R.exe CMD INSTALL --build "C:/path/to/my/code/mgrpoc"

Finally when I start R session and run code 
library(mgrpoc)
myFunction()

I get following error
Loading required package: RODBC
Loading required package: data.table
data.table 1.7.7  For help type: help("data.table")
Error in myValidation(consumption, othercolumn) : 
  object 'consumption' not found
Timing stopped at: 0 0 0 
> 

Anyone would be any help here?

Any help is greatly appreciated.

--
View this message in context: http://r.789695.n4.nabble.com/data-table-packaged-code-throws-error-tp4252693p4252693.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list