df2json: df2json

Description Usage Arguments Examples

View source: R/df2json.R

Description

df2json

It returns a string that contains an array of objects. There are as many JS objects as there are rows in the data frame. The column names are used as the keys of each object. The objects are separated by newlines.

Usage

1

Arguments

df

input dataframe object

Examples

1
2
3
library(df2json)
df <- data.frame(name=c("a", "b", "c"), x=c(NA, 2 ,3), y=c(10, 20, -Inf), show=c(TRUE, FALSE, TRUE))
df2json(df)

Example output

Loading required package: rjson
[1] "[{\"name\":\"a\",\"x\":null,\"y\":10,\"show\":true},\n{\"name\":\"b\",\"x\":2,\"y\":20,\"show\":false},\n{\"name\":\"c\",\"x\":3,\"y\":null,\"show\":true}]"

df2json documentation built on May 2, 2019, 1:03 p.m.