Skip to main content

to_json

to_jsonR Documentation

Convert a file into a JavaScript expression#

Description#

It supports csv and json by default and lets users provide custom handlers if other file formats are used.

Usage#

to_json(input, as_data_frame, read_fun, ...)

Arguments#

inputA character string; the path to the input file.
as_data_frameTRUE or FALSE; whether the data are loaded as a data-frame.
read_funA function to load the input file. Default settings are provided for CSV files and JSON files. The function has to load a data file into an object that can be handled by 'jsonlite::toJSON'. Possible choices include 'utils::read_delim', 'readr::read_csv2', etc.
...Extra arguments to be passed to 'read_fun'.