index.html
<!doctype HTML>
<html>
<head>
<link rel='stylesheet' href="//netdna.bootstrapcdn.com/bootswatch/2.3.1/cosmo/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" >
<link rel='stylesheet' href="//twitter.github.io/bootstrap/assets/js/google-code-prettify/prettify.css">
<link rel='stylesheet' href='//leafletjs.com/dist/leaflet.css'>
<script src='//leafletjs.com/dist/leaflet.js' type='text/javascript'></script>
<style>
.rChart {
display: block
margin: auto auto;
width: 800px;
height: 400px;
}
body {
margin-top: 60px;
}
</style>
</head>
<body>
<div class='container'>
<div class='row'>
<div class='span9'>
<div id='chartfa9e689dfefb' class='rChart nvd3Plot leaflet'></div>
<br/>
<pre><code class='r'>require(rCharts)
map1 = Leaflet$new()
map1$setView(45.5236, -122.675, 4)
map1$tileLayer("//a.tiles.mapbox.com/v3/mapbox.control-room/{z}/{x}/{y}.png", 8)
map1
</code></pre>
</div>
</div>
</div>
<script>
var spec = {
"dom": "chartfa9e689dfefb",
"width": 800,
"height": 400,
"center": [
45.524,
-122.67
],
"viewOpts": [
4
],
"urlTemplate": "//a.tiles.mapbox.com/v3/mapbox.control-room/{z}/{x}/{y}.png",
"layerOpts": {
"": 8,
"attribution": "Map data © <a href=\"//openstreetmap.org\">OpenStreetMap</a>contributors, Imagery © <a href=\"//mapbox.com\">MapBox</a>"
},
"id": "chartfa9e689dfefb"
}
var map = L.map(spec.dom)
.setView(spec.center, spec.viewOpts);
L.tileLayer(spec.urlTemplate, spec.layerOpts)
.addTo(map);
</script>
</body>
<script src="//cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/prettify.js"></script>
<script
src='https://google-code-prettify.googlecode.com/svn-history/r232/trunk/src/lang-r.js'>
</script>
<script>
var pres = document.getElementsByTagName("pre");
for (var i=0; i < pres.length; ++i) {
pres[i].className = "prettyprint linenums";
}
prettyPrint();
</script>
</html>
code.R
require(rCharts)
map1 = Leaflet$new()
map1$setView(45.5236, -122.675, 4)
map1$tileLayer("http://a.tiles.mapbox.com/v3/mapbox.control-room/{z}/{x}/{y}.png", 8)
map1