Learn R Programming

crunch (version 1.30.4)

datasets: Get a catalog of datasets

Description

Crunch datasets are collected in folders called "projects". datasets() can be used to filter a project's contents to see only datasets (and not other projects). You can also use it to pull a catalog of datasets from search results.

Usage

datasets(x = getAPIRoot())

datasets(x) <- value

Value

When x is a ProjectFolder, datasets() returns the folder with its "index" filtered to contain only datasets; otherwise, it returns an object of class DatasetCatalog. The assignment function returns the project x with the given dataset added to it.

Arguments

x

a ProjectFolder or SearchResults that may contain datasets

value

For assignment, a CrunchDataset to move

Details

The datasets()<- assignment function provides an alternative method for moving a dataset into a project. This may be more convenient in some cases than using mv().

Examples

Run this code
if (FALSE) {
# Get the names of the datasets contained in a project
projects() %>%
    cd("Important Clients") %>%
    datasets() %>%
    names()
# The assignment method lets you move a dataset to a project
proj <- cd(projects(), "Important Clients")
ds <- loadDataset("New important client survey")
datasets(proj) <- ds
}

Run the code above in your browser using DataLab