This package requires a valid API auth token to work.
Configuration can be provided in 3 forms:
Config files are the most convenient configuration method. Once saved configuration will be automatically restored when data.world
is loaded.
From the R console:
saved_cfg <- data.world::save_config("YOUR API TOKEN")
data.world::set_config(saved_cfg)
To obtain your API token, visit: https://data.world/settings/advanced For additional configuration options, see ?set_config
Use the data.world package to retrieve data from the site using SQL or SPARQL.
Here is an example:
intro_ds <- "https://data.world/jonloyens/an-intro-to-dataworld-dataset"
team_df <- data.world::query(
data.world::qry_sql("SELECT * FROM DataDotWorldBBallTeam"),
dataset = intro_ds
)
team_df
For additional examples, including parameterized queries and SPARQL, see query
vignette.
For your convenience, this package allows you to publish insights to data projects without leaving R Studio.
Using R Studio’s “Addins” menu, look for DATA.WORLD > New insight
.
Add-in Menu
The add-in will automatically capture the active plot in R Studio’s plot view and give you the opportunity to quickly choose the project, and enter title and description for your insight.
Add-in Window
The dwapi
package simplifies access to data.world REST APIs. dwapi
is bundled and automatically loaded with data.world
. Using it you can create and update datasets, upload data and update metadata, among other things.
For example, to get the definitions of a dataset, you can:
intro_def <- dwapi::get_dataset(intro_ds)
intro_def$description
To learn more about data.world’s REST API, checkout https://docs.data.world/documentation/api and ?dwapi
.