contributor: Get or set contributors

View source: R/contributor.R

contributorR Documentation

Get or set contributors

Description

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.

Usage

contributor(x)

contributor(x, overwrite = FALSE) <- value

Arguments

x

A dataset object created with dataset_df() or as_dataset_df().

overwrite

Logical. If TRUE, replace all existing contributors with value. If FALSE, append value to the existing contributors. Defaults to FALSE.

value

A utils::person object representing a single contributor. If the role field is missing, it will be set to "ctb". If NULL, the dataset is returned unchanged.

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", or

  • a 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")

Value

  • contributor() returns a utils::person or a list of such objects corresponding to contributors.

  • ⁠contributor<-()⁠ returns the updated dataset (invisibly).

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)


dataset documentation built on Nov. 16, 2025, 5:06 p.m.