R - konradmayer/knowledge-base GitHub Wiki

windows quirks

paths

https://stackoverflow.com/a/63078969 from R 4.0.0 Windows paths can be supplied as raw string constants:

r"(E:\RStuff\test.r)"
# [1] "E:\\RStuff\\test.r"

.Renviron and .Rprofile ignored when staring R.exe or Rscript.exe

https://stackoverflow.com/a/61809909

use R.exe --cd-to-userdocs

unicode characters

extended, but based on https://www.casualinferences.com/posts/adding-special-characters-ggplot-labels/

These can be used e.g. in plot labels (must be escaped - i.e. \u00e4):

character output unicode
degree ° u00b0
alpha α u03b1
beta β u03b2
mu µ u00b2
omega Ω u03a9
squared ² u00b3
cubed ³ u00b5
subscript number u208_ (replace with desired number)
e accent aigu é u00e9
e accent grave è u00e8
ü u00fc
ä u00e4

precompile vignettes

https://ropensci.org/blog/2019/12/08/precompute-vignettes/

find non ASCII characters in package code

lapply(list.files("R", include.dirs=FALSE, full.names=TRUE, no..=TRUE), tools::showNonASCIIfile)

date/time

strftime cheatcheet

https://strftime.org/

color

https://cran.r-project.org/web/packages/ggsci/vignettes/ggsci.html

https://github.com/karthik/wesanderson

https://ewenme.github.io/ghibli/

https://cran.rstudio.com/web/packages/oaColors/index.html

https://github.com/jolars/qualpalr

https://github.com/andrewheiss/colourlovers

https://github.com/G-Thomson/Manu

https://pmassicotte.github.io/paletteer_gallery/

https://emilhvitfeldt.github.io/r-color-palettes/discrete.html

https://clauswilke.com/art/post/colors-color-spaces

https://github.com/BlakeRMills/MetBrewer