×
This project is hidden, and needs moderation from an organizer.
Resource
Frictionless Data
With frictionless you can read data from a Data Package (local or remote) into your R environment.
⛶ Fullscreen
↓ Download
Edit
After following the above instructions to publish a Data Package, or using any of the datapackage.json
references you find on https://datahub.io/search - you can use the dataset directly in R, with similar advantages as we discussed in the CKANR exercise.
📦 Data Package: https://github.com/schoolofdata-ch/swiss-hospital-data
⛰️ Data Source: https://opendata.swiss/en/dataset/key-data-on-swiss-hospitals-2017
⚙️ R script:
install.packages("frictionless")
library(frictionless)
library(ggplot2)
# The source of this is
DPURL <- 'https://raw.githubusercontent.com/schoolofdata-ch/swiss-hospital-data/master/datapackage.json'
# Fetch the Data Package and verify that we have loaded it
datapackage <- read_package(DPURL)
# Show the contents of the Package
resources(datapackage)
# Select a resource and read its contents
shc_infra <- read_resource(datapackage, "shc_infra")
# Generate a plot
plot(unlist(shc_infra$JAHR), unlist(shc_infra$AnzStand), type="b", main=datapackage$title)
ggplot(data = shc_infra) +
geom_point(aes(x = Ops, y = KT, color = Typ_de)) +
labs(x = '# Operations', y = 'Kanton', color = 'Typ',
title = datapackage$title,
caption = 'Quelle: db.schoolofdata.ch')