Skip to content

RSPerl...

3 messages · Peter Dalgaard, A.J. Rossini

#
Duncan -
(but sent to R-devel, for any other thoughts?)

How do you envision RSPerl being used?  Without having seen the
details, I can think of playing with strings; is there a preferred
incantation for stringification of R objects (serialization)?

(actually, the main problem I'm having is that I know how I want to code
something like: 
     Robject <- .Perl("perlfunctionhackery", "stringifedRObjectToHack")
which might be something like:
     Robject <- eval(.Perl("perlfunctionhackery","stringifedRObjectToHack"))
but sort of what I'm having problems with thinking about is along the
lines of  
     Robject <- eval(.Perl("perlfunctionhackery",
                           RToString(InitialRObject)))

and my brain isn't kicking into gear).   While I know how to transfer
data as arrays, and the docs suggest I can transfer tables, and that's
fine, I'm wondering how to transfer and contort objects, and if the
above might be a reasonable general sketch, or if there might be
another approach?

best,
-tony
#
rossini@blindglobe.net (A.J. Rossini) writes:
I don't know if it's preferred, but the default thing you get if you
edit() an R object is that the editor is started on the results of
dput() and the result is subjected to eval(parse(...)). Perl might
just be smart enough to handle data in that form.

Another idea would be to use mechanisms like in .Tcl.args where
there's a layer that stringifies R objects (into what? Perl code?)
before passing them to Perl. With Perl's well-known ojections to fixed
rules, that might be tricky, but who knows?

Seeing some sketches of the functionality you want to achieve might be
fruitful.
#
PDB> rossini@blindglobe.net (A.J. Rossini) writes:
    >> Duncan - (but sent to R-devel, for any other thoughts?)
    >> 
    >> How do you envision RSPerl being used?  Without having seen the
    >> details, I can think of playing with strings; is there a
    >> preferred incantation for stringification of R objects
    >> (serialization)?

    PDB> I don't know if it's preferred, but the default thing you get
    PDB> if you edit() an R object is that the editor is started on
    PDB> the results of dput() and the result is subjected to
    PDB> eval(parse(...)). Perl might just be smart enough to handle
    PDB> data in that form.

    PDB> Another idea would be to use mechanisms like in .Tcl.args
    PDB> where there's a layer that stringifies R objects (into what? 
    PDB> Perl code?)  before passing them to Perl. With Perl's
    PDB> well-known ojections to fixed rules, that might be tricky,
    PDB> but who knows?

    PDB> Seeing some sketches of the functionality you want to achieve
    PDB> might be fruitful.

Peter, here's 2 of the simpler examples (silly, but please scale for
rationale) of what I'm wondering about:

I'd like to do:

lm.output <- .Perl("PerlToSplitAndFormatLMandUseWebDAVtoPostToMyWWWSite",
                   lm(y~x))

or similarly,

NewData  <- .Perl("GrabAndMerge2CriticalDataSetsFromTheWWW",
                  NHANES.19xx,
                  NHANES.19yy)

where NHANES.zzzz is a list describing the location and
characteristics of a particular data set.

Everything is trivial in the mathematician's sense to me, except for
getting Perl to parse and/or manipulate the R object. 

best,
-tony