Here, "table" is meant broadly (covering data.frame
, table
,
Printing (as seen in the console) might suffice for a plain-text document to be viewed in monospaced font:
Note: Before making the example data below, make sure you're in an empty folder you can write to. Run getwd()
and read ?setwd
if you need to change folders.
..w = options()$width
options(width = 500) # reduce text wrapping
sink(file = "mytab.txt")
summary(mtcars)
sink()
options(width = ..w)
rm(..w)
Writing to CSV (or another common format) and then opening in a spreadsheet editor to apply finishing touches is another option:
Note: Before making the example data below, make sure you're in an empty folder you can write to. Run getwd()
and read ?setwd
if you need to change folders.
write.csv(mtcars, file="mytab.csv")
knitr::kable
tables::tabular