RMarkdown 練習介面簡介
歡迎來到 RMarkdown 練習介面。這裡和你先前看到的介面有些不同:當你按下「Knit HTML」時,介面會將你的 R Markdown 文件編織(knit)成一個 HTML 檔,並在新的窗格中顯示。你也可以編織成 PDF 檔,但在本課程中我們會以 HTML 為主。
為了方便你練習,我們已包含一些基本的 R 程式碼,會快速使用預設載入的 graphics R 套件與同樣預設載入的資料集 mtcars 繪製一張圖。
本練習屬於課程
在 Tidyverse 中以資料溝通
練習說明
- 在 RMarkdown 檔案最上方的 YAML 標頭,將 title 調整為
"Communicating with Data in the Tidyverse",author 改為你的名字,並設定日期。 - 按下「Knit HTML」按鈕,於新窗格中查看已編織完成的 HTML 檔。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
{"my_document.Rmd":"---\ntitle: \"___\"\nauthor: \"___\"\ndate: \"___\"\noutput: html_document\n---\n\nThe following plot shows the relationship between the number of cylinders and miles per gallon in the `mtcars` dataset.\n\n```{r}\nboxplot(mtcars$mpg ~ mtcars$cyl)\n```\n\nAs one can see, the more cylinders, the less miles per gallons.\n\n\n"}