This function gives you a Dataset object, which refers to a dataset hosted on the Crunch platform. With this Dataset, you can perform lots of data cleaning and analysis as if the dataset were fully resident on your computer, without having to pull data locally.
loadDataset(
dataset,
kind = c("active", "all", "archived"),
project = defaultCrunchProject("."),
refresh = FALSE
)
character, the path to a Crunch dataset to load, or a
dataset URL. If dataset
is a path to a dataset in a project, the path will
be be parsed and walked, relative to project
, and the function will look
for the dataset inside that project. If dataset
is just a string and project
is set to NULL
, the function will assume that dataset
is the dataset id.
character specifying whether to look in active, archived, or all datasets. Default is "active", i.e. non-archived.
ProjectFolder
entity, character name (path) to a project.
Defaults to the project set in envOrOption('crunch.default.project')
or "./" (the project root), if the default is not set.
logical: should the function check the Crunch API for new
datasets? Default is FALSE
.
An object of class CrunchDataset
.
You can specify a dataset to load by its human-friendly "name", within
the project (folder) to find it in. This makes code more
readable, but it does mean that if the dataset is renamed or moved to a
different folder, your code may no longer work. The fastest, most reliable
way to use loadDataset()
is to provide a URL to the dataset–the dataset's
URL will never change.
See cd()
for details of parsing and walking dataset folder/project
paths.
if (FALSE) { # \dontrun{
ds <- loadDatasets("A special dataset", project = "Studies")
ds2 <- loadDatasets("~/My dataset", project = "Studies")
ds3 <- loadDataset("My dataset", project = projects()[["Studies"]]) # Same as ds2
ds4 <- loadDataset("https://app.crunch.io/api/datasets/bd3ad2/")
} # }