list.parse {rlist} | R Documentation |
Convert an object to list with identical structure
Description
This function converts an object representing data to
list that represents the same data. For example, a
data.frame
stored tabular data column-wisely,
that is, each column represents a vector of a certain
type. list.parse
converts a data.frame
to
a list which represents the data row-wisely so that it
can be more convinient to perform other non-tabular data
manipulation methods.
Usage
list.parse(x, ...)
## Default S3 method:
list.parse(x, ...)
## S3 method for class 'matrix'
list.parse(x, ...)
## S3 method for class 'data.frame'
list.parse(x, ...)
## S3 method for class 'character'
list.parse(x, type, ...)
Arguments
x |
|
... |
Additional parameters passed to converter function |
type |
The type of data to parse. Currently json and yaml are supported. |
Value
list
object representing the data in x
Examples
x <- data.frame(a=1:3,type=c('A','C','B'))
list.parse(x)
x <- matrix(rnorm(1000),ncol=5)
rownames(x) <- paste0('item',1:nrow(x))
colnames(x) <- c('a','b','c','d','e')
list.parse(x)
z <- '
a:
type: x
class: A
registered: yes
'
list.parse(z, type='yaml')
[Package rlist version 0.4.6.2 Index]