Skip to contents

Companions to use_dataset() for inspecting and resetting the session's default dataset.

Usage

get_dataset()

has_dataset()

clear_dataset()

dataset_vars()

Value

get_dataset() returns the default data frame (error if none is set); has_dataset() returns a logical; clear_dataset() returns TRUE invisibly; dataset_vars() returns a character vector of column names.

Details

has_dataset() is the safe way to check before calling get_dataset(), which errors when nothing is set. clear_dataset() removes the default so that subsequent calls require an explicit data again – useful at the end of a script or between analyses of different datasets.

Examples

has_dataset()
#> [1] FALSE

use_dataset(podracing_survey)
has_dataset()
#> [1] TRUE

nrow(get_dataset())
#> [1] 1000

clear_dataset()