Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (81 sloc) 2.08 KB
<!DOCTYPE html>
<html lang="en">
<title>OpenCPU Markdown App</title>
<script src="underscore-min.js"></script>
<script src="jquery-1.10.2.min.js"></script>
<script src="opencpu-0.4.js"></script>
<script src="src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
var editor = ace.edit("editor");
//This app requires OpenCPU 1.0.1 or higher!
function domarkdown(e){
var req ="rmdtext", {
text : editor.getSession().getValue()
}, function(session){
$("iframe").attr('src', session.getFileURL("output.html"));
alert("Error: " + req.responseText);
//auto run after 2 seconds of no activity
var update = _.debounce(domarkdown, 2000);
//register event
editor.on("change", update);
//init on start
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
iframe {
position: absolute;
top: 0px;
right: 0px;
width: 604px;
height: 100%;
border: 0;
margin: 0;
z-index: 999999;
<div id="editor">The Normal Distribution
The normal (or Gaussian) distribution is defined as follows:
f(x;\mu,\sigma^2) = \frac{1}{\sigma\sqrt{2\pi}}
e^{ -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2 }
To generate random draws from a normal distribution we use the **rnorm** function:
```{r block1}
output <- rnorm(1000, 100, 15);
The normal distribution has the typical bell shape:
```{r block2, fig.width=8, fig.height=5}
## Kernel density estimation
We can perform density estimation on the sample:
```{r block3, fig.width=8, fig.height=5}
## Carl Friedrich Gauß
This little guy had something to do with it
<iframe src="about:blank"></iframe>