to_json: Create a table in JSON from a tidysummary

View source: R/converters.R

to_jsonR Documentation

Create a table in JSON from a tidysummary

Description

Takes a tidysummary object and converts it into JSON that is returned. If the file argument is supplied, the JSON is saved to a file instead.

Usage

to_json(df, file = NULL, overwrite = FALSE, ...)

Arguments

df

a data frame.

file

file name to save. If file is NULL, then the output is returned. Otherwise, there is no output.

overwrite

whether to overwrite the file if it already exists.

...

other arguments passed on to jsonlite::toJSON().

Details

Sends the data frame to jsonlite::toJSON().

Value

A character vector of the table source code. If file is not NULL, however, nothing is returned.

See Also

tidysummary()

Examples

## Not run: 
data <- tidysummary(iris)

to_json(data)
to_json(data, file="summary.json")

## End(Not run)

peterdalle/tidysummary documentation built on March 27, 2022, 4:30 p.m.