Bibtex, Mendeley & Sweave
Mendeley’s repeated entries in the bibfile is particularly annoying with my sweave workflow, as it throws an error from bibtex command that Make doesn’t want to ignore.
Also, in writing the documentation I’d like to point the .Rnw file to my global library’s bibtex document, but then this means having the .Rnw/tex file generated to by the package pointing to a file that’s outside the package.
To get around both of these issues, I’ve started using bibtool. Bibtool can generate a smaller bibfile of only the included citations, and remove the duplicates, which I can use in the package.
bibtool -s -d -x paper.aux global.bib > paper.bib
tex generates the aux file. bibtools generates a local bib file from the citations listed in the .aux using my global bib file, then bibtex can run on the aux and format these citations, which are inserted by re-running tex as usual. Note that this could combine different bibs instead of using a global.bib.
The ubuntu version of bibtool (2.48 alpha) doesn’t handle large bibfiles well, the current version 2.53 seems to do fine. Inspiration for this from tex Q&A.
Minor annoyance: R’s pdflatex compile prints non-breaking spaces as tildes (Q&A query). Currently calling native pdflatex from makefile.
R CMD check now gives a warning if data isn’t compressed. Running R CMD build –resave-data will compress all files optimally, but then need to extract that tarball and copy the compressed data files into the development dirctory. Would be nice if devtools handled this? Updatethe function I wanted is[code]tools:resaveRdaFiles ```
Many packages use print() to communicate with the user for progress, warnings, etc. These should use message() and warning() so these can be suppressed when appropriate. Working around this is hard, instead of suppressMessages, one can wrap the call as (ht Simon, stackoverflow):
.
invisible(capture.output(
out <- some_noisy_function()
))
Updated approach to vignettes with Sweave/knitr
The easiest way to make vignettes in knitr is a bit of a hack. Create a subdirectory in the inst/doc (or vignettes) directory, and add the knitr .Rnw document there. Use knitr to generate .Rnw (which is essentially just a tex document by then) in inst/doc. I do this with a Makefile in that directory, which I run manually ahead of time. The makefile also compiles the local bibliography from the global one.
[gist id=1591001]
wrightscape
Started runs on body-size data from Sam for different phylogenies.
TreeBASE
added TreePar example
yule_4rate <- bd.shifts.optim(x, sampling = c(1,
1, 1, 1), grid = 5, start = 0, end = 60, ME = FALSE,
yule = TRUE)
aic <- sapply(yule_4rate[[2]], function(x) 2 *
(length(x) - 1) + 2 * x[1] )
which.min(aic)
and flushed out text. Sending to Peter and Duncan for a read over.