Re: [R] Delete Comment Lines from SQL String as a Vector

2011-02-21 Thread jim holtman
Here is the way I usually write my SQL: > x <- c(' + select comm, count(*) -- count the number of comms +from myDF-- this is the dataframe +group by comm -- grouping argument + ') > x # as vector [1] "\nselect comm, count(*) -- count the number of comms\n from myDF-- this i

Re: [R] Delete Comment Lines from SQL String as a Vector

2011-02-21 Thread David Winsemius
On Feb 21, 2011, at 6:14 PM, Phil Spector wrote: Mai - sql=c("-- This is a comment line", + "select sysdate -- This is a comment Text" , + " from dual ") use = sub('--.*$','',sql) use[use != ''] [1] "select sysdate " " from dual " Although to get it to print the way yo

Re: [R] Delete Comment Lines from SQL String as a Vector

2011-02-21 Thread Phil Spector
Mai - sql=c("-- This is a comment line", + "select sysdate -- This is a comment Text" , + " from dual ") use = sub('--.*$','',sql) use[use != ''] [1] "select sysdate " " from dual " Although to get it to print the way you listed, you need to reduce the width of the line:

[R] Delete Comment Lines from SQL String as a Vector

2011-02-21 Thread Mai Dang
Hi, I tried to remove the text starts by "--" to the end of the line as below sql=c("-- This is a comment line", "select sysdate -- This is a comment Text" , " from dual ") >sql [1] "-- This is a comment line" [2] "select sysdate -- This is a comment Text" [3] " from dual "