Re: [R] print.data.frame to string?

2012-05-31 Thread ivo welch
great. thanks. exactly what I wanted. /iaw Ivo Welch (ivo.we...@gmail.com) On Thu, May 31, 2012 at 2:53 PM, David L Carlson wrote: > a <- data.frame(x=runif(4), y=runif(4), z=runif(4)) > b <- capture.output(a) > c <- paste(b, "\n", sep="") > cat("Your data set is:\n", c, "\n") >

Re: [R] print.data.frame to string?

2012-05-31 Thread David L Carlson
--- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of ivo welch > Sent: Thursday, May 31, 2012 3:31

Re: [R] print.data.frame to string?

2012-05-31 Thread ivo welch
thanks, jeff. no, not capture.output(), but thanks for pointing me to it (I did not know it). capture.output flattens the data frame. I want the print.data.frame output, so that I can feed it to cat, and get reasonable newlines, too. regards, /iaw Ivo Welch (ivo.we...@gmail.com) J. Fred W

Re: [R] print.data.frame to string?

2012-05-31 Thread Jeff Newmiller
capture.output(print(mydf)) note that df is a base function... best to not use it as a variable. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] print.data.frame to string?

2012-05-31 Thread Greg Snow
What do you mean by prints? You can use capture.output to get what would regularly be printed to the screen into a text vector, or use dput to get a version of an object that could be read back into another R session. On Thu, May 31, 2012 at 2:10 PM, ivo welch wrote: > dear R experts---is there

[R] print.data.frame to string?

2012-05-31 Thread ivo welch
dear R experts---is there a function that prints a data frame to a string? cat() cannot handle lists, so I cannot write cat("your data frame is:\n", df, "\n"). regards, /iaw Ivo Welch (ivo.we...@gmail.com) [[alternative HTML version deleted]] ___