Fabian Peter Hammerle hace 8 años
padre
commit
6ea9f74019
Se han modificado 3 ficheros con 56 adiciones y 15 borrados
  1. 4 0
      .gitignore
  2. 21 4
      Makefile
  3. 31 11
      main.Rmd

+ 4 - 0
.gitignore

@@ -1 +1,5 @@
+*.docx
 *.html
+*.md
+*.pdf
+/figures

+ 21 - 4
Makefile

@@ -1,9 +1,26 @@
-all: index.html
+all: main.md main.docx main.pandoc.html main.knitr.html main.pdf
 
-# markdown --html4tags $^ >$@
+R_OPTS=--no-save --no-restore --quiet
 
-index.html : index.md
+main.md : main.Rmd
+	R ${R_OPTS} -e "library(knitr); knit(input='$<', output='$@')"
+
+main.docx : main.md
+	pandoc --output=$@ $^
+
+main.pandoc.html : main.md
+	pandoc --standalone --output=$@ $^
+
+main.knitr.html : main.Rmd
+	R ${R_OPTS} -e "library(knitr); knit2html(input='$<', output='$@')"
+
+main.pdf : main.md
 	pandoc --output=$@ $^
 
 clean :
-	trash index.html
+	-trash figures
+	-trash main.knitr.html
+	-trash main.pandoc.html
+	-trash main.docx
+	-trash main.md
+	-trash main.pdf

+ 31 - 11
index.md → main.Rmd

@@ -1,5 +1,9 @@
 # h1
 
+```{r knitr_options, include=FALSE}
+opts_chunk$set(fig.path='figures/')
+```
+
 ## font style
 
 **bold**
@@ -21,19 +25,12 @@ _italics_
 
 ## code
 
-
-code block:
-
-```
-print("Hello")
+```cpp
+int main() {
+    return 0;
+}
 ```
 
-or
-
-    int main() {
-        return 0;
-    }
-
 ## quote
 
 > quote
@@ -46,3 +43,26 @@ or
 
 [//]: references
 [1]: https://git.hammerle.me/fphammerle/template-markdown
+
+## R
+
+```{r}
+1+1
+```
+
+Pi is `r pi`.
+
+### plot
+
+```{r}
+plot(1:10)
+```
+
+## R session info
+```{r session_info}
+sessionInfo()
+```
+
+<!--
+https://yihui.name/knitr/options/
+-->