Parsing of the comment character when sourcing a file
On 12-11-28 6:12 AM, Jim Lemon wrote:
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.
It will work in both cases. I suspect you have some other error in your code. There are differences between source() and cut-and-paste, but this isn't one of them. (The main difference I can think of is that source() will parse the whole file and will not run if there are syntax errors, whereas cut-and-paste will execute things one at a time.) Duncan Murdoch