[datatable-help] svSocket+data.table

G See gsee000 at gmail.com
Mon Oct 8 22:48:38 CEST 2012


Adding ";NULL" allows me to create the data.table on the server which
is good enough for my needs.

    > evalServer(con, "x <- as.data.table(mtcars);NULL")
    NULL
    > evalServer(con, class(x))
    [1] "data.table" "data.frame"

Still, it would be nice to be able to send a data.table to/from the
client/server.

    > evalServer(con, x)
    Error in source(objcon, local = TRUE, echo = FALSE, verbose = FALSE) :
      objcon:32:67: unexpected '<'
    31: "drat", "wt", "qsec", "vs", "am", "gear", "carb"), row.names = c(NA,
   32: -32L), class = c("data.table", "data.frame"), .internal.selfref = <

                         ^
Best,
Garrett

On Mon, Oct 8, 2012 at 3:07 PM, G See <gsee000 at gmail.com> wrote:
> I saw the svSocket + data.table video on the data.table project home
> page.  It looks pretty cool, so I am trying to implement it.  I can
> get it to work with a data.table if I save the data.table to a file,
> put the file on the server and load it.  However, I cannot figure out
> how to create a data.table on the server, or to send a data.table to
> the server.
>
> First, I start R and run this:
>
>     > library(svSocket)
>     Loading Tcl/Tk interface ... done
>     > startSocketServer(port=8888)
>     [1] TRUE
>
> In a second instance of R, I run this:
>
>     > library(svSocket)
>     Loading Tcl/Tk interface ... done
>     > con <- socketConnection(port=8888)
>     > evalServer(con, library(data.table))
>     [1] "data.table" "svSocket"   "stats"      "graphics"   "grDevices"
>     [6] "utils"      "datasets"   "methods"    "base"
>
>     > evalServer(con, "x <- as.data.table(mtcars)")
>     Error in source(objcon, local = TRUE, echo = FALSE, verbose = FALSE) :
>       objcon:32:67: unexpected '<'
>     31: "drat", "wt", "qsec", "vs", "am", "gear", "carb"), row.names = c(NA,
>     32: -32L), class = c("data.table", "data.frame"), .internal.selfref = <
>
>                         ^
> If I try to create the data.table in the client and send it to the
> server, R just hangs and I have to hit Ctrl+c to break.
>
>     > library(data.table)
>     data.table 1.8.3  For help type: help("data.table")
>     > evalServer(con, x, as.data.table(mtcars))
>     ^C
>     Warning message:
>     In dump("..Last.value", file <- .f) : deparse may be incomplete
>
> Simple things work fine:
>
>     > evalServer(con, x, 1)
>     [1] TRUE
>     > evalServer(con, x)
>     [1] 1
>
> Also, I should mention that I can run `as.data.table(mtcars)` just
> fine from either terminal without using `evalServer`
>
> It appears that there may be a problem parsing the .internal.selfref attribute.
>
> What am I doing wrong?  Is this beyond the expected use-case?
>
> Thanks,
> Garrett
>
> p.s. sessionInfo below; I have the same problem on both Mac and Linux
>> sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=C                 LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] data.table_1.8.3 svSocket_0.9-53
>
> loaded via a namespace (and not attached):
> [1] svMisc_0.9-67 tcltk_2.15.1  tools_2.15.1
>>


More information about the datatable-help mailing list