kablerow | R Documentation |
knitr::kable enables one to round the number of digits for each column of a table. However, sometimes one wants to format the rows and not the columns. kablerow enables that while using the kable function. It rounds the rows to the desired number of digits and then converts those rounded values to characters, which kable can then print more appropriately.
kablerow(x, rowdigits, namerows = NA, namecols = NA)
x |
an input matrix or data.frame |
rowdigits |
the number of digits desired for each row |
namerows |
should row.names be printed; default=NA. change to TRUE for row.names printing |
namecols |
should col.names be printed; default=NA (which prints V1, V2 ,V3, ...) |
Nothing but it does use knitr::kable to print a formatted matrix
x <- matrix(rnorm(25,mean=5,sd=1),nrow=5,ncol=5)
colnames(x) <- 1:5
numdig <- c(2,3,4,3,2)
rownames(x) <- c("a","b","c","d","e")
kablerow(x,rowdigits=c(2,3,4,3,2),namerows=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.