The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
OCSdata is an R package to help you access and download case study
data files hosted on the OCS GitHub. The package
provides several different functions to enable users to grab the data
they need at different sections in the case study, as well as download
the whole case study repository. All the user needs to use the package
is the name of the case study repository and a file path to the
directory where the data should be saved. The package relies on the
GET()
function from httr to access files
through the GitHub API. The functions use_zip()
and
create_from_github()
from usethis are used to clone and/or
download the case study repositories.
Download the current release version from CRAN:
install.packages("OCSdata")
Download the current development version from GitHub:
# install.packages("devtools")
::install_github("opencasestudies/OCSdata") devtools
These examples download the data files to temporary directories to
avoid overwriting local files. If you’d like to save the files
elsewhere, specify the file path to the desired download location in the
outpath
argument. Or, leave the argument blank to
interactively specify a directory with the R console.
library(OCSdata)
# Starting at data import section:
raw_data("ocs-bp-opioid-rural-urban", outpath = tempdir())
# for raw data in file formats that are easier to import, run:
simpler_import_data("ocs-bp-opioid-rural-urban", outpath = tempdir())
# Starting at data exploration/wrangling sections:
imported_data("ocs-bp-opioid-rural-urban", outpath = tempdir())
# Starting at data visualization/analysis sections:
# for files in CSV format:
wrangled_csv("ocs-bp-opioid-rural-urban", outpath = tempdir())
# for files in RDA format:
wrangled_rda("ocs-bp-opioid-rural-urban", outpath = tempdir())
# Looking for more data on this topic:
extra_data("ocs-bp-opioid-rural-urban", outpath = tempdir())
# Download repository in a zip file:
zip_ocs("ocs-bp-opioid-rural-urban", outpath = tempdir())
# Clone the case study GitHub repository (requires registered PAT):
clone_ocs("ocs-bp-opioid-rural-urban", outpath = tempdir(), fork_repo = TRUE)
# Setting fork_repo = TRUE will fork the repo first and then clone the fork,
# while FALSE will clone the repo directly from the Open Case Studies GitHub.
# The default is fork_repo = NA, which will fork or clone based on your repository
# permissions. This function requires your personal GitHub PAT to be registered in RStudio.
Note: The default argument for outpath
will
trigger an interactive session where the user confirms the
download location.
These examples use the Opioids
in United States case study, but you can use these functions with
any of our case studies. Make sure to use the Case Study
ID for the casestudy
argument. See below to find
your case study’s ID:
All case study data is available in the respective OCS GitHub repositories. However, case study users new to GitHub can find it a confusing process to access data from repositories. On top of that, users then must move the downloaded data into to the appropriate local directory. Overall, this process leaves room for error and acts as a barrier to introductory level students. Troubleshooting these errors can be a headache for both students and instructors and eats away at valuable learning time. OCSdata is an R package that bridges the gap from web-browser to Rstudio, allowing users to automatically download the data they need with simple functions all within R.
This package is licensed under the terms of the MIT license.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.