[R] Parsing of the comment character when sourcing a file

Jim Lemon jim at bitwrit.com.au
Wed Nov 28 12:12:22 CET 2012


In the course of producing some plots for a publication, I wanted to 
mark the places where double counting of cases had occurred. I used 
three symbols, “*”, “^” and “#”. While these worked fine if the code was 
pasted into the R console, the “#” (comment character) was recognized 
even when quoted if the code was read with “source”, causing a silent 
error. Trying to escape the character didn’t work. This is mainly to 
alert those who try to use a comment character as a marker that it will 
work when the code is pasted, but not when the same code is sourced.

Jim



More information about the R-help mailing list