dgetFromString {RNetica}R Documentation

Serializes an R object to a string

Description

The function dputToString converts an R object to a string which can then be turned back into an R object using dgetFromString.

Usage

dgetFromString(str)
dputToString(obj)

Arguments

str

A string containing a serialized object

obj

An object to be serialized

Details

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.

Value

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.

Author(s)

Russell Almond

See Also

NodeUserObj), NetworkUserObj

Examples

x <- sample(1L:10L)

x1 <- dgetFromString(dputToString(x))

stopifnot(all(x==x1))


[Package RNetica version 0.8-2 Index]