Karel Fišer
2017
problem –> { paper/brain/console } –> script –> …
.R
comment to organise code into logicle blocks (chunks)
RStudio: comment line ending with at least four dashes (-), equal signs (=), or hashes (#) creates a code section.
Rstudio: Ctrl + Shift + c
# ---- random numbers ---------------
x <- rnorm(10)
y <- rnorm(10) # inline comment
* However consider e.g. tidyverse for its consistency
png()
, svg()
) and text/tables (write.table()
)pandoc
to convert them all## Markdown
Markdown is a plain text with simple means of formatting.
For example:
- - for lists
- * for **emphasis**
- # for headers
[Links](goo.gl/5zczVk) go into parentheses.
Markdown is a plain text with simple means of formatting.
For example:
Links go into parentheses.
rmarkdown
(–> knitr
+ pandoc
)## R Markdown
Rmarkdown includes also code and its outputs!
\```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
\```
Rmarkdown includes also code and its outputs!
plot(iris$Sepal.Length, iris$Sepal.Width)
```{r chunk_name, option1=TRUE}
~60 chunk options, e.g.:
option | run | code | output |
---|---|---|---|
eval=FALSE | no | no | no |
include=FALSE | YES | no | no |
echo=FALSE | YES | no | YES |
opts_chunk$set(echo=FALSE, message=FALSE, warning=FALSE)
-–
title: “Best R analysis ever”
date: “24.12.2200”
author: “Me & Co.”
output: html_document
-–
note: soft. devel. might be part of data analysis. How to combine them?
script naming:
R_intro_9.R
leuko_pat_1
functions (verbs): countLeuko