Skip to contents

[Deprecated] Please use as_cff_person()

Usage

cff_parse_person(person)

cff_parse_person_bibtex(person)

Arguments

person

It can be either:

  • A person or list of person object created with utils::person().

  • A character object or vector representing a person or persons.

Value

A person in format cff.

See also

Examples

# Create a person object
a_person <- person(
  given = "First", family = "Author",
  role = c("aut", "cre"),
  email = "first.last@example.com", comment = c(
    ORCID = "0000-0001-8457-4658",
    affiliation = "An affiliation"
  )
)

a_person
#> [1] "First Author <first.last@example.com> [aut, cre] (<https://orcid.org/0000-0001-8457-4658>, An affiliation)"

cff_person <- as_cff_person(a_person)

cff_person
#> - family-names: Author
#>   given-names: First
#>   email: first.last@example.com
#>   orcid: https://orcid.org/0000-0001-8457-4658
#>   affiliation: An affiliation

# Back to person object with S3 Method
as.person(cff_person)
#> [1] "First Author <first.last@example.com> (<https://orcid.org/0000-0001-8457-4658>, An affiliation)"

# Parse a string
a_str <- paste0(
  "Julio Iglesias <fake@email.com> ",
  "(<https://orcid.org/0000-0001-8457-4658>)"
)
as_cff_person(a_str)
#> - family-names: Iglesias
#>   given-names: Julio
#>   email: fake@email.com
#>   orcid: https://orcid.org/0000-0001-8457-4658

# Several persons
persons <- c(person("Clark", "Kent"), person("Lois", "Lane"))

as_cff_person(persons)
#> - family-names: Kent
#>   given-names: Clark
#> - family-names: Lane
#>   given-names: Lois

# Or you can use BibTeX style if you prefer

x <- "Frank Sinatra and Dean Martin and Davis, Jr., Sammy and Joey Bishop"

as_cff_person(x)
#> - family-names: Sinatra
#>   given-names: Frank
#> - family-names: Martin
#>   given-names: Dean
#> - family-names: Davis
#>   given-names: Sammy
#>   name-suffix: Jr.
#> - family-names: Bishop
#>   given-names: Joey

as_cff_person("Herbert von Karajan")
#> - family-names: Karajan
#>   given-names: Herbert
#>   name-particle: von