Skip to content
/ jsonwriter Public

R library to write regression results to JSON files

Notifications You must be signed in to change notification settings

gn0/jsonwriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonwriter: R library to write regression results to JSON files

Description

jsonwriter is an R library for writing regression results to JSON files. Currently only supports fixest.

How to install

Open the R console and enter the following:

install.packages("devtools")
devtools::install_git(url = "https://codeberg.org/gnyeki/jsonwriter/")

Example

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"
}

About

R library to write regression results to JSON files

Resources

Stars

Watchers

Forks