Learn R Programming

crunch (version 1.30.4)

archive-and-publish: Get and set "archived" and "published" status of a dataset

Description

"Archived" datasets are excluded from some views. "Draft" datasets are visible only to editors, while published datasets are available to all viewers. A dataset can either be published or in draft, but not both. These properties are accessed and set with the "is" methods. You can also set the properties by assigning into the function. The verb functions archive and publish are alternate versions of the setters.

Usage

is.archived(x)

is.archived(x) <- value

is.draft(x)

is.draft(x) <- value

is.published(x)

is.published(x) <- value

# S4 method for CrunchDataset is.archived(x)

# S4 method for CrunchDataset is.draft(x)

# S4 method for CrunchDataset is.published(x)

# S4 method for CrunchDataset,logical is.archived(x) <- value

archive(x)

# S4 method for CrunchDataset,logical is.draft(x) <- value

# S4 method for CrunchDataset,logical is.published(x) <- value

publish(x)

# S4 method for DatasetCatalog is.archived(x)

# S4 method for DatasetCatalog is.draft(x)

# S4 method for DatasetCatalog is.published(x)

# S4 method for DatasetCatalog,logical is.archived(x) <- value

# S4 method for DatasetCatalog,logical is.draft(x) <- value

# S4 method for DatasetCatalog,logical is.published(x) <- value

Value

For the getters, the logical value of whether the dataset is archived, in draft mode, or published, where draft and published are inverses. The setters return the dataset.

Arguments

x

CrunchDataset

value

logical

Examples

Run this code
if (FALSE) {
ds <- loadDataset("mtcars")
is.draft(ds) # FALSE
is.published(ds) # TRUE
identical(is.draft(ds), !is.published(ds))
# Can make a dataset a "draft" by:
is.draft(ds) <- TRUE
is.published(ds) # FALSE
# Could also have set is.published(ds) <- FALSE
# Now, can go the other way by setting is.draft, is.published, or:
ds <- publish(ds)
is.published(ds) # TRUE

is.archived(ds) # FALSE
is.archived(ds) <- TRUE
is.archived(ds) # TRUE
# Could have achieved the same effect by:
ds <- archive(ds)
}

Run the code above in your browser using DataLab