to_yaml {opm} | R Documentation |
Convert some R object to YAML or JSON.
## S4 method for signature 'MOPMX' to_yaml(object, ...) ## S4 method for signature 'YAML_VIA_LIST' to_yaml(object, ...) ## S4 method for signature 'list' to_yaml(object, sep = TRUE, line.sep = "\n", json = FALSE, listify = nodots, nodots = FALSE, ...)
object |
Object of one of the classes belonging to
|
sep |
Logical scalar. Prepend YAML
document separator ‘ |
line.sep |
Character scalar used as output line separator. |
json |
Logical scalar. Create JSON instead
of YAML? If so, |
listify |
Logical scalar indicating whether after conversion to a list its non-list elements should be converted to lists if they have names. (Names of named vector are not conserved by default in output YAML). |
nodots |
Logical scalar indicating whether dots in list names should be converted to underscores. This is necessary in some situations (we met this problem when storing JSON documents in a document-oriented database). Converted names will additionally be marked by prepending an underscore, which assists in getting the original spelling back but is anything else than fail-safe. |
... |
Optional other arguments passed to
|
YAML is a useful data-serialisation standard that is understood by many programming languages. It is particularly more human readable than XML, and vector-like data structures (such as phenotype microarray measurements) can be much more compactly encoded.
Many PM data sets at once can be
batch-converted into YAML format using
batch_opm
. The output format for the child
classes is described in detail there, as well as other
aspects relevant in practice.
JSON is a subset of YAML and (in most
cases) can also be parsed by a YAML parser. For
generating JSON, the toJSON
function
from the rjson package would be used.
Character scalar (YAML string).
yaml::as.yaml yaml::yaml.load_file json::toJSON
Other conversion-functions: as.data.frame
,
extract
, extract_columns
,
flatten
, merge
,
oapply
, opmx
,
plates
, rep
,
rev
, sort
,
split
, unique
## Not run:
##D
##D # Let 'x' be a any convertible object
##D # Store the data in file 'out.yml' in YAML format.
##D write(to_yaml(x), "out.yml")
## End(Not run)