library(tblr) x <- data.frame("0"=c(1,0,0,0,0,0,0,0,0), "1"=c(2,0,0,0,0,0,0,0,0), "2"=c(0,3,0,0,0,0,0,0,0), "3"=c(0,0,0,0,0,0,0,0,0), "17"=c(0,5,0,0,0,0,0,0,0), SS=c(0,0,0,0,0,0,0,0,0), DIL=c(0,0,1,0,0,0,0,0,0), FCL=c(0,0,1,0,0,0,0,0,0), Sum=c(0,0,0,0,0,0,0,0,0), check.names=FALSE, row.names=c("0","1","2","3","17","SS","DIL","FCL","Sum"))
tblr allows us to easily specify formatting of tables, for example to produce something like this:
t <- tblr(x, col.names=T, row.names=T, width=30, align="center") + grid() + vlines(c(0,3,5,-1)) + hlines(c(0,3,5,-1)) + cells(lapply(1:8, function(x) c(x,x)), background="lightgray") + frame() + caption("This is an ugly styled caption", top=FALSE, align="right", color="green", background="pink") #which(!diag(1,nrow(d),ncol(d)) & d>0, arr.ind=T) for(i in 1:nrow(x)) for(j in 1:ncol(x)) if(x[[j]][[i]]>0 & i!=j) t <- t + cell(i,j, background="whitesmoke") t <- t + cell(2,5,background="yellow", color="red") #t t <- tblr(x, row.names=F, width=30, align="center") + frame() + rows(seq(2,nrow(x),2), background="whitesmoke") t
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.