Comments (12)
I changed the example and added a comment about this in README on the github repo.
from rdpack.
Thanks, the message "possibly non-existing or duplicated key(s) in bib file" is not ideal and could, at least, be improved e.g., adding : or missing a required field).
This is a very old message (from 2018, amended in 2020). I will check why it doesn't emit the actual error message, as well.
There is the separate issue of whether Rdpack could/should render silently trivial Biblatex differences, such as using 'date' when year is missing or journaltitle if title is missing.
from rdpack.
Thanks for the report and the praise :).
The second argument of the macros specifies the package from which the references should be taken, in this case package maar
. Just change {Rdpack}
to {maar}
:
\insertCite{white1980usinglsapproxunknownregfuncs}{maar}
\insertCite{white1980heteroskedasticconsistentcovest}{maar}
For more details
\insertCite{@see also @buja2019modelsasapproximationspart1 and @buja2019modelsasapproximationspart2;textual}{maar}
You get warnings , not errors, in such cases since if you prefer to fix references later it may be frustrating not to be able to build your package.
Let me know if this solves the issue. Also, it would be useful to know if viewRd
works as expected, since I have had very little feedback on it.
from rdpack.
Thanks @GeoBosh - that did partially help resolve the issue! I knew I'd made a simple mistake.
You get warnings , not errors, in such cases since if you prefer to fix references later it may be frustrating not to be able to build your package.
That's true, I've reflected the issue title to reflect that this is indeed a warning.
Although your suggestion to fix the references later is indeed useful, I'm trying to
document the package in as much detail as every function is written. I'll use this strategy
if we keep getting references warning issues 😄 .
Here is the revised roxygen2
comment:
#' Compute the White sandwich estimator of standard errors for
#' ordinary least squares (OLS) regression. This is based on the series of
#' papers \insertCite{white1980usinglsapproxunknownregfuncs}{maar} and \insertCite{white1980heteroskedasticconsistentcovest}{maar}. For more details \insertCite{@see also @buja2019modelsasapproximationspart1 and @buja2019modelsasapproximationspart2;textual}{maar}
#'
#' @param lm_object (lm) : lm object
#'
#' @return (matrix) : White sandwich estimator of variance for OLS regression
#' @export
#'
#' @importFrom Rdpack reprompt
#' @references
#' \insertAllCited{}
#' @examples
#' \dontrun{
#' n <- 1e5
#' X <- stats::rnorm(n, 0, 1)
#' y <- 2 + X * 1 + stats::rnorm(n, 0, 10)
#' lm_fit <- stats::lm(y ~ X)
#' sandwich_qr_var <- comp_sandwich_qr_var(lm_fit)
#' }
I mention partially resolve, because when I use viewRd
I get the attached screenshot.
- It seems like the references in the main description are indented in a strange way e.g see "for more details..." appears on a new line on a different indentation
- The
insertAllCited{}
does not seem to render the references
Any ideas what may be the issue?
from rdpack.
Regarding '1. It seems like the references in the main description are indented in a strange way e.g see "for more details..." appears on a new line on a different indentation', I don't observe it on my side and more information is needed. If you are rendering it as html in Rstudio, it is probably the way it renders titles. Notice that it takes the text as a title which it probably renders centred. But it is extremely long, so the first line takes the whole line, while the second is incomplete and centred (I think, that is not indentation but centring, but I may be wrong). You probably didn't intend this to be a title but if you did, please follow up with more details.
Regarding "2. The insertAllCited{} does not seem to render the references".
Short answer: don't indent \insertAllCited{}
by four spaces - any other number of spaces, including zero, will do. For example:
#' @references
#' \insertAllCited{}
or even
#' @references \insertAllCited{}
Long answer: This is a markdown
feature, which seems to be used by roxygen2
- lines indented by exactly four spaces are rendered verbatim. In this case the following chunk in your R file
#' @references
#' \insertAllCited{}
is translated to the following snipped in the Rd file:
\references{
\preformatted{\\insertAllCited\{\}
}
\preformatted
is the Rd syntax for verbatim, so the command inside it is not interpreted at all.
I will mention the above in the documentation but I am surprised that it was not reported before.
from rdpack.
Thanks again @GeoBosh
- The first issue is resolved. I should have put the first line as a title, and left a blank line for the before the description. One minor thing, and I don't believe this is an
Rdpack
issue, but there is an extra line and indentation after thelm_object
in the Arguments section. I expected the description to be on the same line. Just wanted to check before I investigated this further (please see screenshot below).
New roxygen2 comment
#' Compute the White sandwich estimator of standard errors for OLS
#'
#' Compute the White sandwich estimator of standard errors for
#' ordinary least squares (OLS) regression, \insertCite{@see @white1980usinglsapproxunknownregfuncs and @white1980heteroskedasticconsistentcovest;textual}{maar}. For
#' more details
#' \insertCite{@see also @buja2019modelsasapproximationspart1 and @buja2019modelsasapproximationspart2;textual}{maar}.
#'
#' @param lm_object An lm (OLS) object
#'
#' @return (matrix) White sandwich estimator of variance for OLS regression
#'
#' @export
#'
#' @importFrom Rdpack reprompt
#'
#' @references \insertAllCited{}
#'
#' @examples
#' \dontrun{
#' n <- 1e5
#' X <- stats::rnorm(n, 0, 1)
#' y <- 2 + X * 1 + stats::rnorm(n, 0, 10)
#' lm_fit <- stats::lm(y ~ X)
#' sandwich_qr_var <- comp_sandwich_qr_var(lm_fit)
#' }
- The second issue is also resolved with your suggestions - thanks! However, I had copied the indented block directly from the
Rdpack
README
file. See the citations section, theroxygen2
@references
is indented there.
in roxygen2, the references chunk might look like this:
#' @references #' \insertAllCited{}
Perhaps it should be replaced with the suggestion you have provided to help future users?
from rdpack.
Regarding 2., I noticed that my example uses exactly four spaces! This must be relatively recent feature of roxygen2, since I myself have copied that line (though I don't use roxygen2 much).
The text for Description
is typically rendered as a separate paragraph. As to the arguments, in the text rendering I get the explanation on the same line but in pdf and html they are on new line - again, a design decision. This may also depend on the number of characters in the argument's name. viewRd
doesn't do the rendering, it just makes sure that the call to the relevant R functions contain the definitions of the citation macros.
from rdpack.
Regarding 2., I noticed that my example uses exactly four spaces! This must be relatively recent feature of roxygen2, since I myself have copied that line (though I don't use roxygen2 much).
I see. I'm using roxygen2_7.1.1
for reference and the 4 spaces gave me the issue. It may be good to mention both ways of writing this for roxygen2
depending on the version that the user has installed.
The text for
Description
is typically rendered as a separate paragraph. As to the arguments, in the text rendering I get the explanation on the same line but in pdf and html they are on new line - again, a design decision. This may also depend on the number of characters in the argument's name.viewRd
doesn't do the rendering, it just makes sure that the call to the relevant R functions contain the definitions of the citation macros.
Thanks, I will take a further look at the roxygen2
details for this. Appreciate your explanation.
Please feel free to mark this issue as closed.
from rdpack.
I changed the example and added a comment about this in README on the github repo.
Looks great - thanks again for your help on this, and for creating such a nice documentation tool!
from rdpack.
Thanks for the report, too.
from rdpack.
Just noting that another possible cause of the "possibly non-existing or duplicated key(s) in bib file" warning is unexpected formatting in a bib entry.
I encountered the message when devtools::check_man()
ing a package containing
@article{MyKey,
title = {Some study},
author = {Body, Some},
date = {2021}
}
When I installed the package, I also saw a message pointing out that A bibentry of bibtype 'Article' has to specify the field: year
.
Indeed, replacing the date
field with year
allowed the key to be recognized, resolving the issue.
I'm not sure that there's anything that Rdpack can easily do to flag this up as a cause, so am not opening as a new issue, but thought I'd add the note here in case it helps others.
from rdpack.
Thanks! And for what it's worth, Zotero/BetterBibTex uses journaltitle
as an alias for journal
(rather than title
) – not sure if other software uses this field differently.
from rdpack.
Related Issues (20)
- Support for biber? HOT 5
- Switching bibtex parser to rbibutils HOT 2
- genre unknown to bibConvert HOT 4
- README, Troubleshooting HOT 2
- doi entries should generate https links HOT 6
- arXiv entry manipulation for manual url? HOT 4
- include example? HOT 1
- Italic text in \insertCite{} HOT 8
- Using `\doi` in place of `\url` HOT 16
- Superfluous braces when citing an entry HOT 7
- Superlfuous escaped LaTeX specials HOT 2
- InsertAllCited on R6 class documentation HOT 14
- partial argument match of key to keys HOT 5
- Encoding issue on windows HOT 2
- Cryptic error message when calling the RStudio addin with no file open in the editor HOT 1
- CSL support? HOT 6
- Lost Braces issue on Ubuntu-latest (devel) on GH HOT 1
- Spaces after rendered citations HOT 1
- Question about R help page HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdpack.