Learn R Programming

dataset (version 0.3.1)

subject: Create/add/retrieve a subject

Description

Create/add/retrieve a subject

Usage

subject(x)

subject_create( term, schemeURI = NULL, valueURI = NULL, prefix = NULL, subjectScheme = NULL, classificationCode = NULL )

subject(x, overwrite = FALSE) <- value

is.subject(x)

Value

The Subject field of the dataset's attributes.

A named list with the subject term, the subject scheme, URIs and prefix.

Arguments

x

A dataset object created with dataset::dataset.

term

A subject term, for example, "Data sets".

schemeURI

The URI of the subject identifier scheme, for example "http://id.loc.gov/authorities/subjects"

valueURI

The URI of the subject term. "https://id.loc.gov/authorities/subjects/sh2018002256"

prefix

An abbreviated prefix of a scheme URI, for example, "lcch:" representing "http://id.loc.gov/authorities/subjects". Widely used namespaces (schemes) have conventional abbreviations.

subjectScheme

The name of the subject scheme or classification code or authority if one is used. It is a namespace.

classificationCode

The classificationCode subproperty may be used for subject schemes, like ANZSRC, which do not have valueURIs for each subject term.

overwrite

If the attributes should be overwritten. In case it is set to FALSE, it gives a message with the current Subject property instead of overwriting it. Defaults to FALSE.

value

A subject field created by subject.

Examples

Run this code
subject(iris_dataset,
        overwrite = TRUE) <- subject_create(
                                  term  = "Irises (plants)",
                                  schemeURI = "http://id.loc.gov/authorities/subjects",
                                  valueURI = "https://id.loc.gov/authorities/subjects/sh85068079",
                                  subjectScheme = "LCCH",
                                  prefix = "lcch:")
subject(iris_dataset)

Run the code above in your browser using DataLab