Question about R help page
Closed this issue · 10 comments
Thank you for the nice package. I am trying to follow the same steps on GitHub. However, the references I generated on the R help page are different. Do you know why?
The reference part shows \Sexpr[results=rd,stage=build]{Rdpack::insert_ref(key=" xxx",package="xxx")} not the reference format I expected.
I could make a guess or guesses what is wrong. But if you show here what you put in your documentation file (roxygen2 comments if you use them, or the Rd chunk otherwise), I will tell you exactly what is wrong.:)
Even better, put your package on github and I will look it up there,
Thank you for the reply. My R package isn't ready yet. I'm currently working on inserting references. I noticed that some people simply type in the references, while others find Rdpack helpful. However, I've encountered an issue where Rdpack doesn't display the references. I follow exactly the same thing as below. My REFERENCES.bib is like what you have in the inst folder. When I call the reference in R help page, I just use @references \insertRef{xxx}{xxx}, it returns the screenshot. Do you have any suggestions?
Add the following lines to file "DESCRIPTION":
Imports: Rdpack
RdMacros: Rdpack
Make sure the capitalisation of RdMacros: is as shown. If the field RdMacros: is already present, add "Rdpack" to the list on that line. Similarly for field "Imports:".
Add the following line to file "NAMESPACE":
importFrom(Rdpack,reprompt)
The equivalent line for roxygen2 is
#' @importFrom Rdpack reprompt
Create file REFERENCES.bib in subdirectory inst/ of your package and put the BibTeX references in it.
Indeed, more than 400 packages on github and Bioconductor use Rdpack for this purpose.
The second argument to the macro should be the name of your package:
@references \insertRef{xxx}{name_of_your_package}
Please, let me know if this solves the issue.
By the way, it doesn't matter that your package is unfinished. It is very useful to commit and push while you work, at the very least this is a bulletproof backup.
No, it does not slove the issue. @references \insertRef{xxx}{name_of_your_package} gives the results of screen shoot.
Do you know some packages use Rdpack ? Maybe I can check against it.
If you go to the CRAN page of Rdpack, you will see a long list of packages that use it. This includes my packages 'sarima', 'pcts'. Others are plm, etc.
Do you get messages when you build the package? Also, are you trying to just render the page inside Rstudio? What happens if you install the package, load it with library(), and ask for the help page using ?xxx.
Also, as I said, putting the package on github will allow me to see what exactly is going on. Currently, I cannot be sure:
@references \insertRef{xxx}{name_of_your_package}
This is certainly not what you put in the package. You certainly replace xxx with an actual reference and the second argument with the name of your package.
There is no message when I build the package.
Yes, I am trying to just render the page inside R studio.
The screenshot is exactly what happened after I install the package, load it with the library and use the ?xxx.
As I said before, If I don't know exactly what is going on, I can only guess. It is so easy to to put the package to github or send me a link to the source somewhere else.
just checked Rdpack::viewRd shows the result correctly. But not in Rstudio when I use ?xxx, do you know why?
I think that RStudio fixed this several years ago, so it should render it correctly if you have reasonably recent version of RStudio.
Do you use library() or devtools::load_all()? If the former, it might be a regression in RStudio?
I think the issue is I updated something in the package and I am running the check for the package. at the same time, the old package gives this issue. After the check is done, I reinstall the package, it works. Thanks.