Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import OData dataset

Tags:

r

odata

How do I properly download and load in R an OData dataset?

I tried the OData package, and even if the documentation is really simple, I am sure, I am missing something trivial.

I am trying to download and parse in R this dataset, but I cannot get how it is structured. Is it a XML format? Hence, what is the reason for a separator argument?

library(OData)
#What is the correct argument for the separator?
downloadResourceCsv("https://data.nasa.gov/OData.svc/gh4g-9sfh", sep = "")
like image 681
Worice Avatar asked Aug 31 '25 06:08

Worice


1 Answers

As hrbrmstr suggests, use the RSocrata package e.g., go to 1, click on ... in the top right, click on "Access this Dataset via OData", click on "Copy" to copy the OData endpoint, save it:

url <- "https://data.cdc.gov/api/odata/v4/9bhg-hcku"
library(RSocrata)
dat <- read.socrata(url)
like image 166
John Maindonald Avatar answered Sep 02 '25 19:09

John Maindonald