jsonwriter
is an R library for writing regression results to JSON files.
Currently only supports fixest
.
Open the R console and enter the following:
install.packages("devtools")
devtools::install_git(url = "https://github.com/gn0/jsonwriter/")
library(fixest)
library(jsonwriter)
data(quakes)
write_json(
feols(depth ~ mag, quakes),
"jsonwriter_example.json",
extra_fields = list(hello = "world"))
This writes the following JSON object to jsonwriter_example.json
:
{
"call": "feols(fml = depth ~ mag, data = quakes)",
"r_squared": 0.05319375,
"coef": {
"(Intercept)": {
"est": 881.62502357,
"se": 76.4443861,
"t": 11.53289429,
"p": 5.63241902e-29,
"stars": "***"
},
"mag": {
"est": -123.42092104,
"se": 16.48252628,
"t": -7.4879857,
"p": 1.53539289e-13,
"stars": "***"
}
},
"nobs": 1000,
"hello": "world"
}