Package: rjstat 0.4.3
rjstat: Handle 'JSON-stat' Format in R
Handle 'JSON-stat' format (<https://json-stat.org>) in R. Not all features are supported, especially the extensive metadata features of 'JSON-stat'.
Authors:
rjstat_0.4.3.tar.gz
rjstat_0.4.3.zip(r-4.5)rjstat_0.4.3.zip(r-4.4)rjstat_0.4.3.zip(r-4.3)
rjstat_0.4.3.tgz(r-4.5-any)rjstat_0.4.3.tgz(r-4.4-any)rjstat_0.4.3.tgz(r-4.3-any)
rjstat_0.4.3.tar.gz(r-4.5-noble)rjstat_0.4.3.tar.gz(r-4.4-noble)
rjstat_0.4.3.tgz(r-4.4-emscripten)rjstat_0.4.3.tgz(r-4.3-emscripten)
rjstat.pdf |rjstat.html✨
rjstat/json (API)
# Install 'rjstat' in R: |
install.packages('rjstat', repos = c('https://ajschumacher.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/ajschumacher/rjstat/issues2 issues
On CRAN:rjstat-0.4.3(2023-09-05)
Last updated 2 years agofrom:9370d33115. Checks:8 OK. Indexed: yes.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Feb 25 2025 |
R-4.5-win | OK | Feb 25 2025 |
R-4.5-mac | OK | Feb 25 2025 |
R-4.5-linux | OK | Feb 25 2025 |
R-4.4-win | OK | Feb 25 2025 |
R-4.4-mac | OK | Feb 25 2025 |
R-4.3-win | OK | Feb 25 2025 |
R-4.3-mac | OK | Feb 25 2025 |
Exports:as.jsonas.jsonstatfromJSONstatidid<-is.jsonstatis.jsonstat_collectionis.jsonstat_datasetis.jsonstat_dimensionstatusstatus<-toJSONstat
Citation
To cite package ‘rjstat’ in publications use:
Schumacher A, Malmedal H, Magnusson M (2025). rjstat: Handle 'JSON-stat' Format in R. R package version 0.4.3, https://github.com/ajschumacher/rjstat.
ATTENTION: This citation information has been auto-generated from the package DESCRIPTION file and may need manual editing, see ‘help("citation")’.
Corresponding BibTeX entry:
@Manual{, title = {rjstat: Handle 'JSON-stat' Format in R}, author = {Aaron Schumacher and Håkon Malmedal and Måns Magnusson}, year = {2025}, note = {R package version 0.4.3}, url = {https://github.com/ajschumacher/rjstat}, }
Readme and manuals
rjstat: read and write JSON-stat with R
Read and write data sets in the JSON-stat format.
Installation:
From CRAN (most people use this):
install.packages('rjstat')
From github (development version):
library(devtools)
install_github("ajschumacher/rjstat")
Usage:
library(rjstat)
oecd.canada.url <- "https://json-stat.org/samples/oecd-canada.json"
# Read from JSON-stat to a list of data frames:
results <- fromJSONstat(readLines(oecd.canada.url))
names(results)
## [1] "Unemployment rate in the OECD countries 2003-2014"
## [2] "Population by sex and age group. Canada. 2012"
# You can also read in using the typically terser IDs rather than labels.
results <- fromJSONstat(readLines(oecd.canada.url), naming="id")
names(results)
## [1] "oecd" "canada"
# Convert from a list of data frames to a JSON-stat string.
# (The data frames must have exactly one value column.)
library(reshape)
irises <- melt(cbind(iris, Specimen=rep(1:50, 3)),
id.vars=c("Species", "Specimen"))
irisJSONstat <- toJSONstat(list(iris=irises))
cat(substr(irisJSONstat, 1, 76))
## {"version":"2.0","class":"collection","link":{"item":[{"class":"dataset","id
# You can successfully convert back and forth, but only for the features that
# make sense in both R and JSON-stat.
head(fromJSONstat(irisJSONstat)[[1]])
## Species Specimen variable value
## 1 setosa 1 Sepal.Length 5.1
## 2 setosa 1 Sepal.Width 3.5
## 3 setosa 1 Petal.Length 1.4
## 4 setosa 1 Petal.Width 0.2
## 5 setosa 2 Sepal.Length 4.9
## 6 setosa 2 Sepal.Width 3.0
Help Manual
Help page | Topics |
---|---|
Convert to jsonlite json object | as.json |
Create a JSON-stat object | as.jsonstat is.jsonstat is.jsonstat_collection is.jsonstat_dataset is.jsonstat_dimension |
Convert JSON-stat format to data frame(s) | fromJSONstat |
'id' accessors of 'jsonstat' objects | id id<- |
Read and write JSON-stat data sets | rjstat-package rjstat |
'status' accessors of 'jsonstat' objects | status status<- |
Convert data frame(s) to JSON-stat format | toJSONstat |