Links
Comment on page

Examples

Querying data

Execute a query
# Perform a query on the Demo CMS Medicare data.
# Table at https://redivis.com/demo/datasets/1754/tables
data <- (
redivis::query("
SELECT * FROM demo.cms_2014_medicare_data.home_health_agencies
WHERE state = 'CA'
")
$to_tibble()
)
print(data) # data is a tibble
Execute a scoped query
# Perform a query on the Demo CMS Medicare data.
# Table at https://redivis.com/demo/datasets/1754/tables
# We don't need to include fully-qualified table names
# if we scope our query to the appropriate dataset or project
data <- (
redivis::organization("Demo")
$dataset("CMS 2014 Medicare Data")
$query("
SELECT provider_name, average_total_payments
FROM nursing_facilities
INNER JOIN outpatient_charges USING (provider_id)
WHERE state = 'CA'
")
$to_tibble()
)
print(data)

Reading table data

data <- (
redivis::organization("Demo")
$dataset("CMS 2014 Medicare Data")
$table("Hospice providers")
# We can specify an optional max_results argument to only
# load some of the records, and an optional variables
# argument to only load certain variables
$to_tibble(max_results=100, variables=c("name","city","state"))
)
print(data)