# year
i <- regexpr("(?<=\\s{1})\\d{4}(?=-{1})", meta$Built, perl = TRUE)
year <- substring(meta$Built, i, i + 3)

# version
pkg <- meta$Package
vers <- meta$Version
title <- meta$Title
if(is.null(vers))
  vers <- packageVersion(pkg)
note <- paste("R package version", vers)

citHeader(paste("To cite ", pkg, "in publications, please use:"))

bibentry(
  bibtype      = "Manual",
  title        = paste0("{", pkg, "}: ", title),
  author       = personList(as.person("Johan Larsson")),
  year         = year,
  note         = note,
  url          = paste0("https://cran.r-project.org/package=", pkg)
)
