Re: [R] include sql statements

2014-03-03 Thread MacQueen, Don
One way would be sql - scan('stmt.sql', what='') Then sql - paste(sql, collapse=' ') or sql - paste(sql, collapse='\n') After which you can check with cat(sql, '\n') I do this sort of thing when I want to maintain an SQL template in an external file, then modify it in R before using one

Re: [R] include sql statements

2014-03-03 Thread Streng Ge-heim
Thanks a lot. The hint with readLines worked :) Then I got it to work like this: sql - paste(readLines(con = stmnt.sql), collapse = ) result - sqlQuery(db,sql) Michel 2014-03-02 17:52 GMT+01:00 Gabor Grothendieck ggrothendi...@gmail.com: On Fri, Feb 28, 2014 at 5:16 AM, Streng Ge-heim

Re: [R] include sql statements

2014-03-02 Thread Duncan Murdoch
On 14-03-02 8:06 AM, normannus wrote: Am 28.02.2014 20:54, schrieb Duncan Murdoch: On 28/02/2014 5:16 AM, Streng Ge-heim wrote: Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source(scriptname) in the CLI. The sql files (i.e.

Re: [R] include sql statements

2014-03-02 Thread normannus
Am 28.02.2014 20:54, schrieb Duncan Murdoch: On 28/02/2014 5:16 AM, Streng Ge-heim wrote: Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source(scriptname) in the CLI. The sql files (i.e. stmt.sql) contains select statements with

Re: [R] include sql statements

2014-03-02 Thread Jeff Newmiller
R does not require the begin and end quote marks for string literals to be on the same line. There is nothing preventing you from formatting your SQL to your preference right in within R code. --- Jeff Newmiller

[R] include sql statements

2014-02-28 Thread Streng Ge-heim
Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source(scriptname) in the CLI. The sql files (i.e. stmt.sql) contains select statements with joins, line breaks, various characters, they can be quite long. My question is, is there a way

Re: [R] include sql statements

2014-02-28 Thread Duncan Murdoch
On 28/02/2014 5:16 AM, Streng Ge-heim wrote: Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source(scriptname) in the CLI. The sql files (i.e. stmt.sql) contains select statements with joins, line breaks, various characters, they can