2015-07-23-r-rmarkdown.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. title: "Hello R Markdown"
  3. author: "Frida Gomam"
  4. date: 2015-07-23T21:13:14-05:00
  5. categories: ["R"]
  6. tags: ["R Markdown", "plot", "regression"]
  7. ---
  8. <div id="r-markdown" class="section level1">
  9. <h1>R Markdown</h1>
  10. <p>This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <a href="http://rmarkdown.rstudio.com" class="uri">http://rmarkdown.rstudio.com</a>.</p>
  11. <p>You can embed an R code chunk like this:</p>
  12. <pre class="r"><code>summary(cars)
  13. ## speed dist
  14. ## Min. : 4.0 Min. : 2.00
  15. ## 1st Qu.:12.0 1st Qu.: 26.00
  16. ## Median :15.0 Median : 36.00
  17. ## Mean :15.4 Mean : 42.98
  18. ## 3rd Qu.:19.0 3rd Qu.: 56.00
  19. ## Max. :25.0 Max. :120.00
  20. fit &lt;- lm(dist ~ speed, data = cars)
  21. fit
  22. ##
  23. ## Call:
  24. ## lm(formula = dist ~ speed, data = cars)
  25. ##
  26. ## Coefficients:
  27. ## (Intercept) speed
  28. ## -17.579 3.932</code></pre>
  29. </div>
  30. <div id="including-plots" class="section level1">
  31. <h1>Including Plots</h1>
  32. <p>You can also embed plots. See Figure <a href="#fig:pie">1</a> for example:</p>
  33. <pre class="r"><code>par(mar = c(0, 1, 0, 1))
  34. pie(
  35. c(280, 60, 20),
  36. c(&#39;Sky&#39;, &#39;Sunny side of pyramid&#39;, &#39;Shady side of pyramid&#39;),
  37. col = c(&#39;#0292D8&#39;, &#39;#F7EA39&#39;, &#39;#C4B632&#39;),
  38. init.angle = -50, border = NA
  39. )</code></pre>
  40. <div class="figure"><span id="fig:pie"></span>
  41. <img src="/post/2015-07-23-r-rmarkdown_files/figure-html/pie-1.png" alt="A fancy pie chart." width="672" />
  42. <p class="caption">
  43. Figure 1: A fancy pie chart.
  44. </p>
  45. </div>
  46. </div>