Learn R Programming

rapport (version 0.3)

table.json: Convert table-like structures to JSON object

Description

This function takes either a matrix or a data.frame object to extract column names, row names and the "body" of the table-like object, hence exports them to JSON.

Usage

table.json(d, name.rows = "rows", name.cols = "cols",
    name.body = "body")

Arguments

d
either a matrix or a data.frame object
name.rows
a string naming object that contains row names
name.cols
a string naming object that contains columns names
name.body
a string naming object that contains table body

Value

  • string with JSON object containing rows, cols and body attributes.

Examples

Run this code
table.json(mtcars)

    set.seed(1)
    m <- matrix(sample(10, 100, TRUE), 10)
    table.json(m)

Run the code above in your browser using DataLab