[datatable-help] Error in a package that imports data.table

Victor Kryukov victor.kryukov at gmail.com
Sun Mar 3 23:25:52 CET 2013


Hello,

I'm developing an R package which will be used internally at my company, and I have troubles using data.table. I'm very new to package development and I'm not really sure whether the errors I see are related to data.table or not, but here it is anyway.

I have a function that imports data from .csv files and cleans the data (subsets, converting fields to numeric etc.). As the end of the function definition, I convert the resulting data.frame to data.table and return the result:

ProcessData <- function(…) {
	...
	df <- data.table(df)
	df
}

When I use this function standalone, after 

library(data.package)

everything works as expected. However, when I'm defining this function as a part of a package and later call it, I'm getting the following error:

Error in rbind(deparse.level, ...) : 
  could not find function ".rbind.data.table"

Please note that in the package .R files, I'm not importing data.table directly with library(data.package) but rather have `import(data.table)` statement in my NAMESPACE, as recommended here https://github.com/hadley/devtools/wiki/Namespaces. 

When I import data.table directly with library(data.table) after importing my package, everything works as expected.

I suspect there may be something going wrong with namespaces in data.table. 

My environment: I'm using R 2.15.3 on Mac and have tested the above on both data.table 1.8.6 and 1.8.7. Please let me know if I need to provide more info. Any help will be much appreciated!

Regards,
Victor



More information about the datatable-help mailing list