You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
---
output: rmarkdown::github_document
---
`ndjson` : Wicked-fast Streaming JSON ('ndjson') Reader
Rcpp/C++11 wrapper for <https://github.com/nlohmann/json>
The goal is to create a completely "flat" `data.frame`-like structure from ndjson
records.
The following functions are implemented:
- `stream_in`: Stream in JSON from a character vector
- `stream_in_file`: Stream in JSON from a file
### Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/ndjson")
```
```{r echo=FALSE, message=FALSE, warning=FALSE, error=FALSE}
options(width=120)
```
### Usage
```{r message=FALSE}
library(ndjson)
library(microbenchmark)
# current verison
packageVersion("ndjson")
sample_data <- readr::read_lines("http://httpbin.org/stream/100")
length(sample_data)
dplyr::glimpse(ndjson::stream_in(sample_data))
dplyr::glimpse(jsonlite::stream_in(textConnection(sample_data), flatten=TRUE, verbose=FALSE))
microbenchmark(
ndjson={ ndjson::stream_in(sample_data) },
jsonlite={ jsonlite::stream_in(textConnection(sample_data), flatten=TRUE, verbose=FALSE) }
)
```
### Test Results
```{r message=FALSE}
library(ndjson)
library(testthat)
date()
test_dir("tests/")
```