R package README.md files can have those nice CRAN version badges from Metacran (see e.g. https://github.com/hadley/devtools). I am wondering:
Can I also show the current development version (as per DESCRIPTION line "Version: ___")?
I can get started if line numbers are known:
https://stackoverflow.com/a/28332095/1587132
Rstudio renders it nicely as html if I use
<script src="http://gist-it.appspot.com/github/brry/berryFunctions/blob/master/DESCRIPTION?slice=3:5"></script>
However, it seems to be completely ignored in https://github.com/brry/berryFunctions#intro
Related
I've noticed that many books built using RBookdown will have an "on this page" section in the upper right hand corner (displays book subsections). You can see what I'm referring to by looking at Hadley Wickham's "R4DS" book here: https://r4ds.had.co.nz/data-visualisation.html.
After digging through the source code I can't figure out how to create this section. Does anyone know how this section is created?
They are using a new document format bookdown::bs4_book. This new format renders the section in question. See the rdrr.io man page for some more information.
To use the new format, first install the latest bookdown version from github with remotes::install_github("rstudio/bookdown"). Then you can specify the new format for your bookdown project in your _output.yaml file like they have done here.
Note, there are a number of dependencies required to use the new format including downlit, bslib, and notably a version of htmltools >= 0.5.0.9001. downlit can be installed with remotes::install_github("r-lib/downlit") while bslib can be installed with remotes::install_github("rstudio/bslib"), and one would normally be able to install htmltools with just remotes::install_github("rstudio/htmltools"). However, as of this writing the latest version of htmltools is failing its R-CMD-Check, and I was unable to install it on my system. Therefore, I installed the 0.5.0.9001 version by referencing the requisite commit with remotes::install_github("rstudio/htmltools#8c82cc4f869f75ac4f13ee78ab322790ec316d3f").
I am developing an R package in RStudio (R version 3.6.1; RStudio version 1.2.1335) using roxygen2 (version 6.1.1) and am using the \insertCite{} command together with a bibtex file in order to cite references in the documentation for individual functions. I am following the instructions Inserting references in Rd and roxygen2 documentation. Everything works fine, except when I try to include a reference with accented characters. So my REFERENCES.bib file contains the following entry:
#ARTICLE{Cabcdef15,
author={John {\c C}abcdef},
title={A title},
journal={Journal of Applied Stuff},
year={2015},
volume={81},
number={1},
pages={100--200},
}
The {\c C} is the LaTeX command for a C-cedilla (Ç). (I also tried \c{C} and pasting Ç directly and neither resolved the issue.)
I cited this reference in the roxygen2 preamble for my R function myfunction using \insertCite{Cabcdef15}{mypackage}. However, in the documentation output (after running devtools::document() and devtools::build(), installing the package and running library(mypackage) and ?myfunction) the citation appears in my browser (Google Chrome) as (Çabcdef 2015) rather than as (Çabcdef 2015).
Presumably this is an encoding issue. However, from what I read in the aforementioned instructions (under 4.4 Encoding of file REFERENCES.bib) this should be working, provided that I have the line Encoding: UTF-8 in the DESCRIPTION file for my R package, which I do. Hence I am stumped.
I have a strong suspicion you are using a Microsoft operating system.
I have code in a roxygen2 examples block which outputs accented French characters: works fine with non-French locales on MacOS and Linux: Windows makes a mess of it. I have UTF-8 in package DESCRIPTION. For me, the obvious work-around is not to use Windows for documenting the package. UTF-8 everywhere seems to work well for me, except on Windows. The R documentation links are helpful, and, in a related post, the mighty Yihui Xie writes about this issue.
This WONTFIX R issue also hints at the root cause: Windows.
A more palatable and Windows-compatible workaround is discussed in platform specific sections in Writing R Extensions.
I have been using r/exams in some of my last exams and everything has worked fine. This semester, however, r/exams seems to generate the exams in Times New Roman instead of Helvetica, which messes with the character recognition in the scanning process.
Even the minimal example, produces this behavior:
library("exams")
myexam <- list("cholesky.Rnw")
set.seed(403)
ex1 <- exams2nops(myexam, n = 1,
dir = "nops_pdf", name = "demo", date = "2015-07-29",
points = c(1), showpoints = TRUE)
Does anyone have any idea what could have gone wrong? How do I see the intermediate steps? I get no error messages.
Thanks!
Starting from R/exams version 2.3-2 (the current CRAN version at the time of writing) it is enforced that the digits that need to be scanned are always in Helvetica (\fontfamily{phv}) even if the font is switched for the rest of the document.
However, in a plain TinyTeX installation, i.e., after running just tinytex::install_tinytex() the Helvetica font is not installed yet. Just setting \fontfamily{phv} is not enough for TinyTeX to realize that an additional package needs to be installed (psnfss). Therefore, I have modified the devel version of exams on R-Forge to explicitly include \usepackage{helvet}. This will trigger the automatic installation of psnfss in TinyTeX. Installing version 2.3-5 should thus resolve the problem: install.packages("exams", repos = "http://R-Forge.R-project.org"). This will also be released to CRAN in the next days.
Moreover, just for future reference, I went through the source code of exams2nops() to check what packages we use. Partly for historical reasons there are quite a few. Possibly these could also be streamlined.
Basic tools: graphicx, color, amsmath, amssymb, latexsym.
For compatibility with Sweave: verbatim, url, fancyvrb, ae.
Layout etc.: multicol, a4wide, pdfpages, chngpage.
Fonts: helvet, sfmath.
For compatibility with LaTeX produced by pandoc from Markdown: booktabs, longtable, eurosym, textcomp.
“Compile PDF” in RStudio 0.99.902 with R 3.3.0 cannot find references included in the “sos” Sweave vignette that's been part of the “sos” package on CRAN since 2009. It produces “sos.pdf”, which reads mostly OK, except that the inline references are replace by something like “?”.
For example, an entry “\citet[pp. 282-283]{JC09}” that previously translated into “Chambers (2009, pp. 282-283)” now displays as “?, pp. 282-283”. The “\bibitem[Chambers(2009)]{JC09}” entry is still at the end of the file and prints with the Bibliography, but “Compile PDF” in RStudio cannot find it make the proper substitution for “\citet[pp. 282-283]{JC09}”.
Any suggestion on how to fix this?
Thanks,
I have a package on CRAN that I would like to add a ChangeLog for, but I cannot find information anywhere on how to do this.
I looked on the "Writing R Extensions" document that CRAN provides, but it only mentions ChangeLogs and gives no direction (I could find) about how to create one.
I noticed from downloading tarballs from other packages on CRAN (e.g. seacarb) that their ChangeLogs are Unix Executable Files (I'm on a Mac) so that's not too helpful.
I imagine this is a common problem, but Googling "changelog R package" just brings up ChangeLogs for really popular packages...
You can either provide a NEWS file or a ChangeLog file, or both, to describe changes in your package. You have to add these files in the top level folder of your project, i.e. in the same folder as your DESCRIPTION and NAMESPACE.
This is documented in the R package manual in paragraph 1.1 Package structure. In particular, this paragraph points to the GNU standard:
For the conventions for files NEWS and ChangeLog in the GNU project see http://www.gnu.org/prep/standards/standards.html#Documentation.
Hadley points out that "Generally you should use a NEWS file, and not ChangeLog. I think the purpose of ChangeLog (to list every change), has been subsumed by source code control".
To create a NEWS file, simply create a text file called NEWS in the top level folder of your package. You maintain this file by hand.
Here is an extract from the NEWS file from my package miniCRAN (CRAN link):
miniCRAN v0.0-21 (Release date: 2014-08-18)
==============
Changes:
* Changes to defaults in plot.pkgDepGraph() to move legend to left of plot area.
miniCRAN v0.0-20 (Release date: 2014-08-18)
==============
Changes:
* Modified examples to reduce running time, mostly using \dontrun{} sections
NEWS.md files are now also supported by CRAN (Which renders them as html) and more recently by the news() function.
https://cran.r-project.org/doc/manuals/r-devel/NEWS.html
If you are following this and opting for NEWS.md then make sure news() reads the same correctly (at the same time it looks great on GitHub).
You can do the same in your local builds of the packages.
It seems like it has a specific format you have to adhere with.
I tried like this (and it works) (check here)
# *News*
# tidycells 0.1.9 (2019-07-31)
## Initial Submission
* **CRAN** Initial Submission
# tidycells 0.1.5 (2019-07-30)
## Final Codebase Release in GitHub
* Final Release in GitHub for **CRAN** Submission
* Only Minor Documentation Change after this and before next **CRAN** Submission
# tidycells 0.1.0 (2019-07-25)
## Initial Release to GitHub
* Initial Release to GitHub
* Prior to this it was private package