| asList {sevenbridges} | R Documentation |
Doesn't like as.list, only fields and slots are converted,
prepare a object to be conveted to YAML/JSON.
asList(object, ...) ## S4 method for signature 'ANY' asList(object, ...) ## S4 method for signature 'CWL' asList(object, ...) ## S4 method for signature 'SingleEnum' asList(object, ...) ## S4 method for signature 'SimpleList' asList(object, ...) ## S4 method for signature 'DSCList' asList(object, ...)
object |
object, could be S4/R5 object. For example, class CWL, SimpleList. |
... |
other parameters passed to |
a list object or json or yaml file.
## define a S4 object
A <- setClass("A", slots = list(a = "character", b = "numeric"))
## define a reference object which extends 'CWL' class
B <- setRefClass("B", fields = list(x = "character", y = "A"), contains = "CWL")
## new instances
a <- A(a = "hello", b = 123)
b <- B(x = "world", y = a)
## show
b
b$show("JSON")
b$show("YAML")
## You can convert slots/fields into a list
asList(a)
asList(b)
b$toList()
b$toYAML()
b$toJSON()