I am looking for other option to write the output of the print command in R I am using sink() to write the R output to a file. This is similar to what I have:> a=c(1:30) > a[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30> sink("vectorA.txt");print(a);sink()I am looking for othe roptions to save the output of the print() command to text file, not to save the objects. Is there any other way of doing this? Thanks!
cat(file = ) M On Thu, Jan 5, 2012 at 11:05 AM, Ana <rrasterr at gmail.com> wrote:> I am looking for other option to write the output of the print command in R > > I am using sink() to write the R output to a file. This is similar to > what I have: > >> a=c(1:30) >> a > ?[1] ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 10 11 12 13 14 15 16 17 18 19 20 21 22 > 23 24 25 26 27 28 29 30 >> sink("vectorA.txt");print(a);sink() > > I am looking for othe roptions to save the output of the print() > command to text file, not to save the objects. > > Is there any other way of doing this? > > Thanks! > > ______________________________________________ > 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.
On Jan 5, 2012, at 12:05 PM, Ana wrote:> I am looking for other option to write the output of the print > command in R?capture.output> > I am using sink() to write the R output to a file. This is similar to > what I have: > >> a=c(1:30) >> a > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 > 23 24 25 26 27 28 29 30 >> sink("vectorA.txt");print(a);sink() > > I am looking for othe roptions to save the output of the print() > command to text file, not to save the objects. > > Is there any other way of doing this? > > Thanks! > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT
On 12-01-05 12:05 PM, Ana wrote:> I am looking for other option to write the output of the print command in RYou don't say why you want this or what platform you're working on, so it's hard to choose among the many options, but one possibility is to run your script using R CMD BATCH or Rscript. Another is just to copy and paste the results from the console. Duncan Murdoch> > I am using sink() to write the R output to a file. This is similar to > what I have: > >> a=c(1:30) >> a > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 > 23 24 25 26 27 28 29 30 >> sink("vectorA.txt");print(a);sink() > > I am looking for othe roptions to save the output of the print() > command to text file, not to save the objects. > > Is there any other way of doing this? > > Thanks! > > ______________________________________________ > 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.