<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
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 <tt>merge.data.table()</tt>.<br>
<br>
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.<br>
<br>
Thanks for any help! --Mel.<br>
<br>
<br>
Here are reproducible examples.<br>
<br>
Test #1: the code below (the entire content of my R script)
SUCCEEDS:<br>
<br>
<tt># test1.R</tt><tt><br>
</tt><tt>library(data.table)</tt><tt><br>
</tt><tt><br>
</tt><tt>run <- function(...) {</tt><tt><br>
oclear()<br>
</tt><tt> d1 <- data.table(a=c(1,2,3), b=c("a","b","c"))</tt><tt><br>
</tt><tt> d2 <- data.table(e=c("v","a","b"), f=c(4,6,7))</tt><tt><br>
</tt><tt> otable(d1)</tt><tt><br>
</tt><tt> otable(d2)</tt><tt><br>
</tt><tt>}</tt><br>
<br>
This returns a simple web page showing 2 tables:<br>
<table style="font-family: 'Times New Roman'; letter-spacing:
normal; orphans: auto; text-indent: 0px; text-transform: none;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<tbody>
<tr>
<td>1</td>
<td>a</td>
</tr>
<tr>
<td>2</td>
<td>b</td>
</tr>
<tr>
<td>3</td>
<td>c</td>
</tr>
</tbody>
</table>
<table style="font-family: 'Times New Roman'; letter-spacing:
normal; orphans: auto; text-indent: 0px; text-transform: none;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<tbody>
<tr>
<td>v</td>
<td>4</td>
</tr>
<tr>
<td>a</td>
<td>6</td>
</tr>
<tr>
<td>b</td>
<td>7</td>
</tr>
</tbody>
</table>
<br class="Apple-interchange-newline">
<br>
Test #2: the code below (the entire content of my R script) FAILS
with:<tt><span style="color: rgb(0, 0, 0); font-family: 'Times New
Roman'; font-size: medium; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none;"><br>
<tt>Error in `[.default`(x, i) : invalid subscript type 'list'</tt></span></tt><br>
<br>
<tt># test2.R<br>
</tt><tt>
library(data.table)</tt><tt><br>
</tt><tt>
</tt><tt><br>
</tt><tt>
run <- function(...) {</tt><tt><br>
oclear()<br>
</tt><tt>
d1 <- data.table(a=c(1,2,3), b=c("a","b","c"))</tt><tt><br>
</tt><tt>
d2 <- data.table(e=c("v","a","b"), f=c(4,6,7))</tt><tt><br>
</tt><tt>
otable(d1)</tt><tt><br>
</tt><tt>
otable(d2)</tt><tt><br>
</tt><tt>
setkey(d1, b)</tt><tt><br>
</tt><tt>
setkey(d2, e)</tt><tt><br>
</tt><tt>
otable(d1[d2])</tt><tt><br>
</tt><tt>
}</tt><br>
<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Melanie BACOU
International Food Policy Research Institute
Agricultural Economist, HarvestChoice
Work +1(202)862-5699
E-mail <a class="moz-txt-link-abbreviated" href="mailto:mel@mbacou.com">mel@mbacou.com</a>
Visit harvestchoice.org </pre>
</body>
</html>