Hello!
In the guidelines I've read:
"Comment your code. Entire commented lines should begin with # and one
space.
Short comments can be placed after code preceded by two spaces, #, and
then one space. "
Just wondering if there is no way to comment something out "in the
middle" of a line? Example:
Original code:
mystrings<-c("a","b","c")
Desired commented code:
mystrings<-c("a", # want "b" to be commented out, but not
"c" # "c")
So that it is read as: mystrings<-c("a","c")
Not possible?
Thanks!
--
Dimitri Liakhovitski
marketfusionanalytics.com
On Sep 9, 2011, at 12:21 PM, Dimitri Liakhovitski wrote:> Hello! > In the guidelines I've read: > > "Comment your code. Entire commented lines should begin with # and > one space. > Short comments can be placed after code preceded by two spaces, #, and > then one space. " > > Just wondering if there is no way to comment something out "in the > middle" of a line? Example: > Original code: > mystrings<-c("a","b","c") > > Desired commented code: > mystrings<-c("a", # want "b" to be commented out, but not "c" # "c") > So that it is read as: mystrings<-c("a","c") > > Not possible?Not possible. Comments are ended by newlines. And why would you not want: mystrings<-c("a", # want "b" to be commented out, but not "c" "c") -- David Winsemius, MD West Hartford, CT
On 09/09/2011 12:21 PM, Dimitri Liakhovitski wrote:> Hello! > In the guidelines I've read: > > "Comment your code. Entire commented lines should begin with # and one space. > Short comments can be placed after code preceded by two spaces, #, and > then one space. "Which guidelines are those? They seem reasonable, but they put more restrictions on comments than the parser enforces. In particular, the spaces are irrelevant. If you have a # symbol in the line, not in a quoted string, it starts a comment that runs to the end of the line. Duncan Murdoch> Just wondering if there is no way to comment something out "in the > middle" of a line? Example: > Original code: > mystrings<-c("a","b","c") > > Desired commented code: > mystrings<-c("a", # want "b" to be commented out, but not "c" # "c") > So that it is read as: mystrings<-c("a","c") > > Not possible? > Thanks! >