---
output:
  knitrBootstrap::bootstrap_document:
    theme.chooser: TRUE
    highlight.chooser: TRUE
---

<!--
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{2D Graphs}
%\VignetteDepends{xtable, corrplot, igraph}
-->
# Tables #
### Regular R output ###
```{r 2d_data}
#for the dataset
data('mtcars')
mcor <-cor(mtcars)
# Print mcor and round to 2 digits
round(mcor,digits=2)
```
### HTML table using xtable ###
```{r 2d_xtable, results='asis'}
library(xtable)
print(xtable(mcor), type='html', comment=F)
```
# 2d graphs #
These 2d examples are both from Winsong Chang's excellent [R Graphics Cookbook](http://www.amazon.com/R-Graphics-Cookbook-Winston-Chang/dp/1449316956).

## Correlation Matrix Example ##

### Correlation plot ###
```{r 2d_plot, dev='png', warning=FALSE}
library(corrplot)
corrplot(mcor)
```
## Network Graph Example ##
```{r 2d_network_data, dev='png', error = TRUE}
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](http://jimhester.com)
Created: 2013 Mar 27 10:54:38 PM
Last Modified: 2014 Apr 17 04:53:58 PM
