Skip to content
Prev 312203 / 398506 Next

Parsing of the comment character when sourcing a file

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