Yuan, Rebecca
2013-Mar-21 13:20 UTC
[R] How to store data frames into pdf file and csv file.
Hello, I have a data frame> mdl.summaryest.coef std.err t.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = "a.pdf", paper = "a4r") mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that:> pdf(file = result2, paper = "a4r")> mdl.summaryest.coef std.err t.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820> dev.off()pdf 2 And when I open the a.pdf, the error message says "There was an error opening this document. The file is already open or in use by another application." How could I save this data frame into a pdf file? If I have another data frame, such as> st = data.frame(est.aic, est.aic)> stest.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca ---------------------------------------------------------------------- This message, and any attachments, is for the intended r...{{dropped:5}}
Bert Gunter
2013-Mar-21 13:41 UTC
[R] How to store data frames into pdf file and csv file.
Well, you might start by reading ?pdf, where you will find that it is for storing **graphics** not data! Then read ?write.table -- but this will be a text file, not a pdf. -- Bert On Thu, Mar 21, 2013 at 6:20 AM, Yuan, Rebecca < rebecca.yuan@bankofamerica.com> wrote:> Hello, > > I have a data frame > > > mdl.summary > est.coef std.err t.stat > intercept 0.0011625517 0.0002671437 4.351784 > aa -0.0813727439 0.0163727943 -4.969997 > dummy1 -0.0002534873 0.0001204000 -2.105376 > dummy2 -0.0007784864 0.0001437537 -5.415417 > bb -0.0002856727 0.0001090387 -2.619920 > cc 0.0003563825 0.0001114803 3.196820 > > > and would like to store it to a pdf file, I use > > pdf(file = "a.pdf", paper = "a4r") > mdl.summary > dev.off() > > to store this mdl.summary into a pdf file a.pdf. However, I can see from > the terminal that: > > > > pdf(file = result2, paper = "a4r") > > > mdl.summary > > est.coef std.err t.stat > > intercept 0.0011625517 0.0002671437 4.351784 > > aa -0.0813727439 0.0163727943 -4.969997 > > dummy1 -0.0002534873 0.0001204000 -2.105376 > > dummy2 -0.0007784864 0.0001437537 -5.415417 > > bb -0.0002856727 0.0001090387 -2.619920 > > cc 0.0003563825 0.0001114803 3.196820 > > > dev.off() > > pdf > > 2 > > And when I open the a.pdf, the error message says "There was an error > opening this document. The file is already open or in use by another > application." How could I save this data frame into a pdf file? > > If I have another data frame, such as > > > > st = data.frame(est.aic, est.aic) > > > st > > est.aic est.aic.1 > > 1 -1654.986 -1654.986 > > How could I save it to a .csv file? > > Thanks very much! > > Cheers, > > Rebecca > > ---------------------------------------------------------------------- > This message, and any attachments, is for the intended...{{dropped:25}}
jim holtman
2013-Mar-21 13:43 UTC
[R] How to store data frames into pdf file and csv file.
Here is one way of doing it:> xest.coef std.err t.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820> # capture the output as a string vector > xo <- capture.output(x) > plot.new() # new page > # now add text to plot > text(0, 0, paste(xo, collapse = '\n'), family = 'mono')On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca < rebecca.yuan@bankofamerica.com> wrote:> Hello, > > I have a data frame > > > mdl.summary > est.coef std.err t.stat > intercept 0.0011625517 0.0002671437 4.351784 > aa -0.0813727439 0.0163727943 -4.969997 > dummy1 -0.0002534873 0.0001204000 -2.105376 > dummy2 -0.0007784864 0.0001437537 -5.415417 > bb -0.0002856727 0.0001090387 -2.619920 > cc 0.0003563825 0.0001114803 3.196820 > > > and would like to store it to a pdf file, I use > > pdf(file = "a.pdf", paper = "a4r") > mdl.summary > dev.off() > > to store this mdl.summary into a pdf file a.pdf. However, I can see from > the terminal that: > > > > pdf(file = result2, paper = "a4r") > > > mdl.summary > > est.coef std.err t.stat > > intercept 0.0011625517 0.0002671437 4.351784 > > aa -0.0813727439 0.0163727943 -4.969997 > > dummy1 -0.0002534873 0.0001204000 -2.105376 > > dummy2 -0.0007784864 0.0001437537 -5.415417 > > bb -0.0002856727 0.0001090387 -2.619920 > > cc 0.0003563825 0.0001114803 3.196820 > > > dev.off() > > pdf > > 2 > > And when I open the a.pdf, the error message says "There was an error > opening this document. The file is already open or in use by another > application." How could I save this data frame into a pdf file? > > If I have another data frame, such as > > > > st = data.frame(est.aic, est.aic) > > > st > > est.aic est.aic.1 > > 1 -1654.986 -1654.986 > > How could I save it to a .csv file? > > Thanks very much! > > Cheers, > > Rebecca > > ---------------------------------------------------------------------- > This message, and any attachments, is for the intended...{{dropped:22}}