I'm wondering is it possible to customise R help files so that certain text is colour coded and easier to read. rdoc
already does this except that it sends the output to the console. I would instead, like it to be sent to the help panel (i'm using Rstudio
). Is there any workaround for this?
If we run ?lm
normally, we can see the usual help file in the help panel on the right below but when you do it again after using rdoc
in Rstudio
we get the help file colour coded which is great but its sent to the console output (left side). Ideally, we would like it to remain on display in the help panel as we are running code. The way it is now - it disappears the minute you run something.
?lm
#devtools::install_github("mdequeljoe/rdoc")
library(rdoc)
options(rdoc.by_section = FALSE)
rdoc(lm)
I want to put the code into my .rprofile
similar to @csgillespie .rprofile. Note, if you follow his code you can use ?lm
instead of having to call rdoc(lm)
directly to produce the colour coded console output.
I have a feeling this can't be done easily (if at all?) but interested to hear any suggestions.
Thanks
This is possible, but a little involved. You'll need your own css file defined to do it, though it would be possible to create a function that writes appropriate css.
As a proof of concept, I have used a copy of the "R.css" file defined inside every package's "/html" folder, and just changed the h2 color to red, with the file saved locally as "my.css".
Anyway, once you have the css file, this function will show the appropriate help file with the appropriate styling in your R viewer window:
So, for example, if I do:
I get: