RMarkdown 练习界面简介
欢迎使用 RMarkdown 练习界面。它与您之前见过的界面略有不同:当您点击 "Knit HTML" 时,系统会将您的 R Markdown 文档编织为一个 HTML 文件,并在新的面板中显示。您也可以将其编织为 PDF 文件,但在本课程中我们将坚持使用 HTML。
为方便起见,我们已包含了一些基础 R 代码,利用默认加载的 graphics R 包,以及同样默认加载的数据集 mtcars,可以快速生成一幅图。
本练习是课程的一部分
在 Tidyverse 中用数据进行沟通
练习说明
- 将 YAML 头部(RMarkdown 文件最上方)中的标题改为
"Communicating with Data in the Tidyverse",作者改为您的姓名,日期也做相应更新。 - 点击 "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"}