Skip to contents

Parse a person or string to a valid format for a CITATION.cff file. This is a helper function designed to help on adding or replacing the auto-generated authors of the package.

Usage

cff_parse_person(person)

cff_parse_person_bibtex(person)

Arguments

person

A person object created with person() or a character string. See Details.

Value

A cff object ready to be used on cff_create().

Details

The person parameter of the function could be:

  • For cff_parse_person(): A person object or a character coercible to person. See person() for details.

  • For cff_parse_person_bibtex(): A string with the definition of an author or several authors, using the standard BibTeX notation. See Markey (2007) for a full explanation.

See Examples for more information.

References

Examples

# Parse a person object

cff_parse_person(person(
  given = "First",
  family = "Author",
  role = c("aut", "cre"),
  email = "[email protected]",
  comment = c(
    ORCID = "0000-0001-8457-4658",
    affiliation = "An affiliation"
  )
))
#> family-names: Author
#> given-names: First
#> email: [email protected]
#> orcid: https://orcid.org/0000-0001-8457-4658
#> affiliation: An affiliation

# Parse a string

cff_parse_person("Julio Iglesias <[email protected]>")
#> family-names: Iglesias
#> given-names: Julio
#> email: [email protected]

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

cff_parse_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"

cff_parse_person_bibtex(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

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