contributor() is a lightweight wrapper around creator() that
works only with contributors. It retrieves or updates only the contributor
entries in the dataset's bibliographic metadata.
Arguments
- x
A dataset object created with
dataset_df()oras_dataset_df().- overwrite
Logical. If
TRUE, replace all existing contributors withvalue. IfFALSE, appendvalueto the existing contributors. Defaults toFALSE.- value
A
utils::personobject representing a single contributor. If therolefield is missing, it will be set to"ctb". IfNULL, the dataset is returned unchanged.
Value
contributor()returns autils::personor a list of such objects corresponding to contributors.contributor<-()returns the updated dataset (invisibly).
Details
All people are stored in the author slot of the underlying
utils::bibentry. This helper preserves primary creators and filters or
updates only those entries that represent contributors.
A contributor is defined as:
a person with
role == "ctb", ora person with a
comment[["contributorType"]].Primary creators (authors) typically have
role %in% c("aut", "cre").Contributors can be further annotated with metadata in
comment, for example:
comment = c(contributorType = "hostingInstitution", ORCID = "0000-0000-0000-0000")See also
Other bibliographic helper functions:
creator(),
dataset_format(),
dataset_title(),
description(),
geolocation(),
get_bibentry(),
language,
publication_year(),
publisher(),
relation(),
rights(),
subject()
Examples
df <- dataset_df(data.frame(x = 1))
creator(df) <- person("Jane", "Doe", role = "aut")
# Add a contributor
contributor(df, overwrite = FALSE) <-
person("GitHub",
role = "ctb",
comment = c(contributorType = "hostingInstitution")
)
# Replace all contributors
contributor(df) <- person("Support", "Team", role = "ctb")
# Inspect only contributors
contributor(df)
#> [1] "GitHub [ctb] (contributorType: hostingInstitution)"
#> [2] "Support Team [ctb]"
