subject: Get/Add subject(s) to a dataset

View source: R/subject.R

subjectR Documentation

Get/Add subject(s) to a dataset

Description

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.

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.

Value

The subjects as a data.frame of terms

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)

 y <- data.frame()
 subject(y) <- "R (Computer program language)"
 subject(y) <- "Questionnaires--Computer programs"
 subject(y)

dataset documentation built on March 31, 2023, 10:24 p.m.