## Example 1: Principal labels in portuguese
library(xtable)
bp2 <- bpca(gabriel1971)
tbl <- xtable(bp2)
rownames(tbl) <- gsub('Eigenvectors','Autovetores',rownames(tbl))
rownames(tbl) <- c(rownames(tbl)[1:9],'Autovalores','Variância retida','Variância acumulada')
dimnames(tbl)[[2]] <- c('CP 1','CP 2')
print(tbl)
## Example 2: With bold in the column
tbl1 <- xtable(bp2)
bold <- function(x){
paste('\textbf{',
x,
'}')
}
print(tbl1,
sanitize.colnames.function = bold)
# Example 3: With italic in the rows
tbl2 <- xtable(bp2)
italic <- function(x){
paste('& \textit{',
x,
'}')
} # It is necessary the character "&" to adapt the number of column of the table!
print(tbl2,
sanitize.rownames.function = italic)
Run the code above in your browser using DataLab