Tables

Regular R output

#for the dataset
data('mtcars')
mcor <-cor(mtcars)
# Print mcor and round to 2 digits
round(mcor,digits=2)

HTML table using xtable

library(xtable)
print(xtable(mcor), type='html', comment=F)

2d graphs

These 2d examples are both from Winsong Chang's excellent R Graphics Cookbook.

Correlation Matrix Example

Correlation plot

library(corrplot)
corrplot(mcor)

Network Graph Example

library(igraph)
# Specify edges for a directed graph
gd <-graph(c(1,2, 2,3, 2,4, 1,4, 5,5, 3,6))
plot(gd)
# For an undirected graph
gu <-graph(c(1,2, 2,3, 2,4, 1,4, 5,5, 3,6),directed=FALSE)
# No labels
plot(gu,vertex.label=NA)

Author: Jim Hester Created: 2013 Mar 27 10:54:38 PM Last Modified: 2014 Apr 17 04:53:58 PM



Try the knitrBootstrap package in your browser

Any scripts or data that you put into this service are public.

knitrBootstrap documentation built on May 2, 2019, 9:30 a.m.