print_table.Rd
Given a data frame, prints to console a formatted table of the results.
print_table(tbl, return = F)
A formatted data frame.
Logical; if TRUE
, returns
the character vector with each formatted
row.
If return
is TRUE
returns the
vector of character strings with the formatted output
for each row of the table.
data("mtcars")
tbl <- aggregate(mtcars$mpg, mtcars[, c("cyl", "vs")], mean)
tbl$x <- round(tbl$x, 1)
colnames(tbl) <- c("# of cylinders", "Engine type", "Miles per gallon")
print_table(tbl)
#> # of cylinders | Engine type | Miles per gallon |
#> 4 | 0 | 26 |
#> 6 | 0 | 20.6 |
#> 8 | 0 | 15.1 |
#> 4 | 1 | 26.7 |
#> 6 | 1 | 19.1 |