How to add degree symbol using roxygen2 for R
documentation?
°C
works in pdf, but it html, it is shown as °C
.
Here is the session info.
R version 3.4.0 (2017-04-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252 LC_MONETARY=English_India.1252
[4] LC_NUMERIC=C LC_TIME=English_India.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0
To add any non-ASCII characters in R
documentation using roxygen2
, the encoding must be declared using the tag @encoding
.
So when °C
is used in the roxygen code, adding the tag @encoding UTF-8
will render it correctly for html as well as pdf.
This can be checked with
path <- "path to Rd file"
tools::checkRd(path)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With