forked from Eric-Guo/R-SDSS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR-markdown-first-demo.Rmd
67 lines (41 loc) · 1.8 KB
/
R-markdown-first-demo.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# A minimal R Markdown example
# R Markdown最小示例
A quote (引言):
> Markdown is not LaTeX.
> Markdown 不是 Latex.
To compile me, run this in R:
为了使用,请在R命令行下运行:
library(knitr)
knit2html('R-markdown-first-demo.Rmd')
library(markdown)
markdownToHTML('R-markdown-first-demo.md','R-markdown-first-demo.html')
See [output here](http://cvprstudio.sandisk.com/files/R-SDSS/R-markdown-first-demo.html).
## code chunks
A _paragraph_ here. A code chunk below (remember the three backticks):
```{r}
1+1
.4-.7+.3 # what? it is not zero! (由于浮点数计算原因)
```
## graphics
It is easy. I did not really show the plot here; if you want it, remove the option `eval=FALSE` from the chunk header below.
```{r markdown-plot-first-demo}
plot(1:10)
hist(rnorm(1000))
```
## inline code
Yes I know the value of pi is `r pi`, and 2 times pi is `r 2*pi`.
## math
Sigh. You cannot live without math equations. OK, here we go: $\alpha+\beta=\gamma$. Note this is not supported by native markdown. You probably want to try RStudio, or at least the R package **markdown**, or the function `knitr::knit2html()`.
## nested code chunks
You can write code within other elements, e.g. a list
1. foo is good
```{r}
strsplit('hello indented world', ' ')[[1]]
```
2. bar is better
## FTP sync
You can setting up a FTP sync by modify the file ftpsync.settings in Sublime Text 2 Editor, so it enable you to modify the file in local but upload file at the same time to remote cvprstudio server.
Before that you should firstly setting up the right user and password in ftpsync.settings.
## conclusion
Nothing fancy. You are ready to go. When you become picky, go to the [knitr website](http://yihui.name/knitr/).
![knitr logo](http://yihui.name/knitr/images/knit-logo.png)