Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing date when adding additional citations #2784

Closed
gowerc opened this issue Sep 18, 2024 · 2 comments
Closed

Missing date when adding additional citations #2784

gowerc opened this issue Sep 18, 2024 · 2 comments

Comments

@gowerc
Copy link

gowerc commented Sep 18, 2024

Apologies in advance I'll admit I'm not 100% sure what I am doing so sorry if this is actually user error...

For our package we wanted to retain the default automatically generated citation but add in an additional publication citation. It appears the recommended way to do this from the pkgdown docs is to use a inst/citation file. Additionally from the R/CRAN manual they provide an example of retaining the automatic generated entry whilst including an additional static bibtex entry by populating the file as:

## R package reference generated from DESCRIPTION metadata
citation(auto = meta)

## NLME book
bibentry(bibtype = "Book",
         title = "Mixed-Effects Models in S and S-PLUS",
         author = c(person(c("José", "C."), "Pinheiro"),
                    person(c("Douglas", "M."), "Bates")),
         year = "2000", publisher = "Springer", address = "New York",
         doi = "10.1007/b98882")

However when we do this and then use pkgdown::build_home() we get the following warning

Warning message:
In citation(auto = meta) :
  could not determine year for ‘rbmi’ from package DESCRIPTION file

Which results in the citation date being populated as ???:
image

This appears to be due to the Date information not being populated in our DESCRIPTION file, though searching online I can see a couple of posts from tidyverse members who recommend not populating this field as it will be populated automatically upon CRAN submission and if done manually will likely get out of date.

Would it be possible to address this within pkgdown or is there something I am missing here? Currently I am working around this by adding the following to my inst/citation file (though it is not clear to me how robust this is):

if (is.null(meta[["Date/Publication"]])) {
    meta["Date/Publication"] <- as.character(Sys.time())
}
@jayhesselberth
Copy link
Collaborator

jayhesselberth commented Nov 29, 2024

As you discovered, adding Date to DESCRIPTION can cause issues. Does your workaround populate the ??? in the package citation?

@jayhesselberth
Copy link
Collaborator

Closing for now, please re-open if you still have an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants