Rstudio 的例子
這是一個儲存為 .Rmd 的指令碼,而 r 指令碼儲存為 .R。
要編寫指令碼,可以使用 render
函式或使用 Rstudio 中的快捷按鈕。
---
title: "Rstudio exemple of a rmd file"
author: 'stack user'
date: "22 July 2016"
output: html_document
The header is used to define the general parameters and the metadata.
## R Markdown
This is an R Markdown document.
It is a script written in markdown with the possibility to insert chunk of R code in it.
To insert R code, it needs to be encapsulated into inverted quote.
Like that for a long piece of code:
```{r cars}
`summary(cars)`
```
And like ``r cat("that")`` for small piece of code.
## Including Plots
You can also embed plots, for example:
```{r echo=FALSE}
`plot(pressure)`
```