datasets: Get a catalog of datasets

View source: R/get-datasets.R

datasetsR Documentation

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

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().

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.

Examples

## Not run: 
# 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

## End(Not run)

crunch documentation built on Aug. 31, 2023, 1:07 a.m.