Learn R Programming

compareGroups (version 4.5.1)

printTable: 'Nice' table format.

Description

This functions prints a table on the console in a 'nice' format.

Usage

printTable(obj, row.names = TRUE, justify = 'right')

Arguments

obj

an object of class 'data.frame' or 'matrix'. It must be at least two columns, the first columns is considered as the 'row.names' and is left justified (if the 'row.names' argument is set to TRUE), while the rest of the columns are right justified.

row.names

logical indicating whether the first column or variable is treated as a 'row.names' column and must be left-justified. Default value is TRUE.

justify

character as 'justify' argument from format function. It applies to all columns of the data.frame or matrix when 'row.names' argument is FALSE or all columns excluding the first one otherwise. Default value is 'right'.

Value

No object is returned.

See Also

compareSNPs

Examples

Run this code
# NOT RUN {
require(compareGroups)

data(regicor)

# example of the coefficients table from a linear regression
model <- lm(chol ~ age + sex + bmi, regicor)
results <- coef(summary(model))
results <- cbind(Var = rownames(results), round(results, 4))
printTable(results)

# or visualize the first rows of the iris data frame. 
# In this example, the first column is not treated as a row.names column and it is right justified.
printTable(head(iris), FALSE)

# the same example with columns centered
printTable(head(iris), FALSE, 'centre')


# }

Run the code above in your browser using DataLab