[R] do not execute newline command

From: Lorenzo Cattarino <l.cattarino_at_uq.edu.au>
Date: Tue, 05 Apr 2011 17:40:59 +1000

Hi R-users,

To automate the creation of scripts, I converted the code (example below) into a character string and wrote the object to a file:

Repeat <- "
myvec <- c(1:12)
cat('vector= ', myvec, '\n')

write (Repeat, 'yourpath/test.R')

the problem is that one line of the code is a "cat" command. In the output file (i.e. test.R), the newline symbol gets executed and I don't want that.

Any idea on how to do that?

        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Apr 2011 - 08:13:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 08:50:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive