You've enabled R, now what?

The data.world R package makes it easy to query datasets and use data.world's REST API.

Install and configure the data.world R package.

Using an R console (like R Studio), you can use the data.world R package to run queries, import datasets, upload data, and more

  1. Install the data.world package for R
  2. devtools::install_github("datadotworld/data.world-r", build_vignettes = TRUE)
    Note: You will need to have the devtools package for R installed to run the previous command. If that is not already installed, you can install it from CRAN using the command install.packages("devtools")
  3. Configure the package with your API token.
  4. saved_cfg <- data.world::save_config("YOUR API TOKEN")
    data.world::set_config(saved_cfg)
    Note: You will need to have your data.world API token, which you can get from data.world's R & R Studio integration page.
  5. View the Quickstart vignette to view more information on the data.world package.
  6. library(data.world)
    vignette("quickstart", package = "data.world")

Import your first query.

Using the data.world package, import your first query:

  1. Choose your dataset and retrieve your SQL or SPARQL query.
  2. Example: Note the below query includes specific query parameters. You can also simplify your query by using SELECT * FROM DataDotWorldBBallTeam
    intro_ds <- "https://data.world/jonloyens/an-intro-to-dataworld-dataset"
    
    sample_query <- data.world::qry_sql(paste0(
    "SELECT t.Name, t.Height, s.AssistsPerGame ",
    "FROM DataDotWorldBBallTeam as t ",
    "JOIN DataDotWorldBBallStats as s ON t.Name = s.Name ",
    "ORDER BY s.AssistsPerGame DESC"))
    
    data.world::query(sample_query, dataset = intro_ds)
  3. Use the available functions to begin modeling your data.

What next?

Here are some things you can do with R and data.world:

  • Use the Addins menu to quickly add a new Insight to data.world from R Studio.
  • Use the included dwapi package to update datasets, upload files, list all tables in a project, and more.

Want to see more information on the data.world + R Integration? check it out here.