Skip to content
Prev 296206 / 398506 Next

print.data.frame to string?

It will work if you paste a "\n" to the end of each line:

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")

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352