[datatable-help] Problem with data.table and FastRWeb
Bacou, Melanie
mel at mbacou.com
Mon Feb 17 11:14:45 CET 2014
Hi,
I am testing an R script using FastRWeb (through Rserve). FastRWeb works
as expected and I can successfully runs Simon Urbanek's examples.
Problems arise when I try to merge datatables. It seems FastRWeb cannot
find merge.data.table().
I'm using plenty of other libraries (ggplot, raster, RJDBC, etc.) that
execute successfully through FastRWeb scripts, so I'm guessing it's
something peculiar to data.table.
Thanks for any help! --Mel.
Here are reproducible examples.
Test #1: the code below (the entire content of my R script) SUCCEEDS:
# test1.R
library(data.table)
run <- function(...) {
oclear()
d1 <- data.table(a=c(1,2,3), b=c("a","b","c"))
d2 <- data.table(e=c("v","a","b"), f=c(4,6,7))
otable(d1)
otable(d2)
}
This returns a simple web page showing 2 tables:
1 a
2 b
3 c
v 4
a 6
b 7
Test #2: the code below (the entire content of my R script) FAILS with:
Error in `[.default`(x, i) : invalid subscript type 'list'
# test2.R
library(data.table)
run <- function(...) {
oclear()
d1 <- data.table(a=c(1,2,3), b=c("a","b","c"))
d2 <- data.table(e=c("v","a","b"), f=c(4,6,7))
otable(d1)
otable(d2)
setkey(d1, b)
setkey(d2, e)
otable(d1[d2])
}
--
Melanie BACOU
International Food Policy Research Institute
Agricultural Economist, HarvestChoice
Work +1(202)862-5699
E-mail mel at mbacou.com
Visit harvestchoice.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140217/532a421d/attachment.html>
More information about the datatable-help
mailing list