Skip to contents

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)

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.

Value

The Subject field of the dataset's attributes.

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

Examples

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)
#> $term
#> [1] "Irises (plants)"
#> 
#> $subjectScheme
#> [1] "LCCH"
#> 
#> $schemeURI
#> [1] "http://id.loc.gov/authorities/subjects"
#> 
#> $valueURI
#> [1] "https://id.loc.gov/authorities/subjects/sh85068079"
#> 
#> $classificationCode
#> NULL
#> 
#> $prefix
#> [1] "lcch:"
#> 
#> attr(,"class")
#> [1] "subject"  "function"