Is it possible to write a table to a file in JSON format in R?

前端 未结 3 1327
滥情空心
滥情空心 2021-02-13 16:35

I\'m making word frequency tables with R and the preferred output format would be a JSON file. sth like { \"word\" : \"dog\", \"frequency\" : 12 } Is there any

3条回答
  •  野性不改
    2021-02-13 17:09

    These days I would typically use the jsonlite package.

    library("jsonlite")
    toJSON(mydatatable, pretty = TRUE)
    

    This turns the data table into a JSON array of key/value pair objects directly.

提交回复
热议问题