read_bson | R Documentation |
Reads BSON data from a mongoexport
dump file directly into R (if it can fit
in memory). This utility does not attempt to convert result into one big single
data.frame: the output is always a vector of length equal to total number of
documents in the collection.
read_bson(file, as_json = FALSE, simplify = TRUE, verbose = interactive())
file |
path or url to a bson file |
as_json |
read data into json strings instead of R lists. |
simplify |
should nested data get simplified into atomic vectors and
dataframes where possible? Only used for |
verbose |
print some progress output while reading |
It is enabled by default to simplify the individual data documents using the same rules as jsonlite. This converts nested lists into atomic vectors and data frames when possible, which makes data easier to work with in R.
An alternative to this function is to import your BSON file into a local mongodb server using the mongo$import() function. This requires little memory and once data is in mongodb you can easily query and modify it.
diamonds <- read_bson("https://jeroen.github.io/data/diamonds.bson")
length(diamonds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.