Skip to contents

Add one or more subject terms to the dataset's metadata.

Usage

subject(x)

subject(x, overwrite = FALSE) <- value

subject_create(
  term,
  subjectScheme = NA_character_,
  schemeURI = NA_character_,
  valueURI = NA_character_
)

Arguments

x

An R object

overwrite

Defaults to FALSE, in which case new subject(x) <- "Subject" calls are binding further Subjects to the already set Subject properties.

value

Subject terms, or a Subject object created by subject_create.

term

A term, or a character vector of multiple terms.

subjectScheme

The scheme to which the term corresponds. If there are multiple terms, provide the subjectScheme(s) in the same order. Optional.

schemeURI

The URI(s) of the subject identifier scheme. If there are multiple terms, provide the schemeURIs in the same order as the terms. Optional.

valueURI

The URI of the subject term. If there are multiple terms, provide the valueURIs in the same order as the terms. Optional.

Value

The subjects as a data.frame of terms

Details

In the Dublin Core elements, dct::subject is defined Typically, the subject will be represented using keywords, key phrases, or classification codes. It is recommended as a best practice to use a controlled vocabulary.
In DataCite, subjects are defined as key phrases from a controlled library.

Examples

x <- data.frame( geo = c("AL", "MK"),
                value = c(1,2))
my_subject <- subject_create (
                  term = c("R (Computer program language)",
                           "Questionnaires--Computer programs"),
                  subjectScheme = rep("LC Subject Headings", 2),
                  schemeURI = rep("http://id.loc.gov/authorities/subjects",2),
                  valueURI = c("https://id.loc.gov/authorities/subjects/sh2002004407.html",
                               "http://id.worldcat.org/fast/1085693/")
)
 subject(x) <- my_subject
 subject(x)
#>                                term       subjectScheme
#> 1     R (Computer program language) LC Subject Headings
#> 2 Questionnaires--Computer programs LC Subject Headings
#>                                schemeURI
#> 1 http://id.loc.gov/authorities/subjects
#> 2 http://id.loc.gov/authorities/subjects
#>                                                    valueURI
#> 1 https://id.loc.gov/authorities/subjects/sh2002004407.html
#> 2                      http://id.worldcat.org/fast/1085693/

 y <- data.frame()
 subject(y) <- "R (Computer program language)"
 subject(y) <- "Questionnaires--Computer programs"
 subject(y)
#>                                term subjectScheme schemeURI valueURI
#> 1     R (Computer program language)          <NA>      <NA>     <NA>
#> 2 Questionnaires--Computer programs          <NA>      <NA>     <NA>