Learn R Programming

QCA (version 0.5-1)

prettyTable: Print a nicely formatted matrix or truth table

Description

R prints the content of a matrix with the values alligned to the right. This function computes the number of spaces needed to reach the middle of the column (minus one for odd number of characters) and adds a certain number of spaces to each value from the table in order to alling these values to the middle.

Usage

prettyTable(mytable)

Arguments

mytable
a matrix

Value

  • a matrix with character elements

See Also

print

Examples

Run this code
mymatrix <- matrix(sample(0:1, 20, replace=TRUE), nrow=5)
colnames(mymatrix) <- c("First", "Second", "Third", "Fourth")
rownames(mymatrix) <- c("One", "Two", "Three", "Four", "Five")
print(prettyTable(mymatrix))

Run the code above in your browser using DataLab