data.frame.to.list: data.frame.to.json

Description Usage Arguments Details Value Author(s) Examples

View source: R/datanode.R

Description

Create a list representation of a data.frame

Usage

1

Arguments

df

data.frame to represent as a list

Details

We represent a data.frame as an hash of hashes. Factors are first coerced into characters.

The outer hash is keyed by the rownames of your data.frame The inner hash is keyed by the colnames of your data.frame

Value

list

Author(s)

Brad Friedman

Examples

1
2
3
4
5
6
7
df <- data.frame(A=1:3, B=3:1, C=factor(c("foo","bar","foo")), row.names = c("one", "two", "three"))
## Should give the following
## list(one=list(A=1, B=3, C="foo"),
##      two=list(A=2, B=2, C="bar"),
##      three=list(A=3, B=1, C="foo"))
data.frame.to.list(df)
data.frame.to.list(head(cars))

AnalysisPageServer documentation built on April 28, 2020, 6:32 p.m.