Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Created July 26, 2012 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramnathv/3182540 to your computer and use it in GitHub Desktop.
Save ramnathv/3182540 to your computer and use it in GitHub Desktop.
Power of Templates in Slidify
<slide class="{{ classes }}" id="{{ id }}">
<hgroup>
{{{ header}}}
</hgroup>
<article>
{{{ content }}}
</article>
</slide>
--- &twocol w1:40% w2:60%
## Probability Distribution ##
The probability distribution of a random variable X tells us what possible
values X can take and how to assign probabilities to those values.
*** left
```{r tab1, message = F}
require(prob)
require(xtable)
Y = addrv(tosscoin(3, makespace = TRUE), FUN = function(x){
sum(x == 'H')
})
xtable(Y)
```
*** right
```{r fig.width = 4, out.width = '350px', message = F}
require(ggplot2)
qplot(factor(X), probs, data = Y, geom = 'bar', stat = 'summary', fun.y = 'sum') + xlab('X') + ylab('Probability')
```
---
layout: slide
---
{{{ content }}}
<div style='float:left;width:{{{w1}}};' class='centered'>
{{{ left }}}
</div>
<div style='float:right;width:{{{w2}}};'>
{{{ right }}}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment