dgetFromString {RNetica} | R Documentation |
The function dputToString
converts an R object to a string
which can then be turned back into an R object using
dgetFromString
.
dgetFromString(str) dputToString(obj)
str |
A string containing a serialized object |
obj |
An object to be serialized |
These functions call the base R functions dget
and
dput
using a string buffer as the connection.
Thus, they serialize the R object and return a string value which can
be stored in a NeticaNode
(see
NodeUserObj
) or or NeticaBN
(see
NetworkUserObj
).
Note that the object must be self-contained.
The function dputToString
returns a character scalar containing
the serialized object. Note: Sometimes R “helpfully” adds
line breaks, returning a vector of strings. This can be fixed by
using paste(dputToString(obj),collapse=" ")
.
The function dgetFromString
returns an arbitrary R object
depending on what was stored in str
.
Russell Almond
x <- sample(1L:10L) x1 <- dgetFromString(dputToString(x)) stopifnot(all(x==x1))