-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path01-Overview.Rmd
169 lines (84 loc) · 7.16 KB
/
01-Overview.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Overview
```{r, include=FALSE, comment=FALSE}
library(tidyverse, quietly = TRUE)
library(kableExtra)
```

Before we get busy downloading and installing the actual software, here is the big picture.
----------------------
## R vs. R Studio
```{r, echo=FALSE}
data.frame("R" = c("{width=100px}",
"Programing Language",
"Install and Ignore",
"Engine",
"{width=500px}"),
"R Studio" = c("{width=200px}",
"Interface Program",
"Interact with Constantly",
"Dashboard",
"{width=500px}")) %>%
kableExtra::kable(col.names = c("R", "R Studio"),
align = "c")
```
"Many users think of $R$ as a statistics system. We prefer to think of it of an environment within which statistical techniques are implemented. $R$ can be extended (easily) via packages. There are about eight packages supplied with the $R$ distribution and many more (over 10,000) are available through the $CRAN$ family of Internet sites covering a very wide range of modern statistics."
- [www.r-project.org](https://www.r-project.org/about.html)
"Where as $R$ is a *programming language* that runs computations, $R Studio$ is an *integrated development environment (IDE)* that provides an interface by adding many convenient features and tools. So the way of having access to a speedometer, rearview mirrors, and a navigation system makes driving much easier, using **$RStudio’s$ interface makes using $R$ much easier** as well." - [Chester Ismay and Albert Y. Kim](https://ismayc.github.io/moderndive/index.html)
```{block, type="rmdlink"}
For a more in-depth discussion on the difference between $R$ and $R Studio$ IDE, watch this [DataCamp video (2m52s)](https://campus.datacamp.com/courses/working-with-the-rstudio-ide-part-1/orientation?ex=1).
```
----------------------
## R Markdown vs. R Notebook
```{r, echo=FALSE}
data.frame(Rmd = c("",
"Plain text that includes shorthand notation to denote formatting, instead of relying on a text editor program display (MS Word). Files are saved with the `.Rmd` extension."),
nb = c("{width=225px}",
"A specific kind of `.Rmd` file in which the code chunks may be interactively executed/run onscreen and the results/output are shown directly below each code chunk.")) %>%
kableExtra::kable(col.names = c("R Markdown", "R Notebook"),
align = "c")
```
>$R Markdown$ documents are fully reproducible. You may use the productive **notebook** interface to **weave together narrative text and code** to produce elegantly formatted output.
>
>-[@R-rmarkdown].
```{block type='rmdlink', echo=TRUE}
**More details at the R Studio website:** [R Markdown, lesson 1 ](https://rmarkdown.rstudio.com/lesson-1.html) and [R Notebooks](https://rmarkdown.rstudio.com/r_notebooks)
```
----------------------
## knit-R

With the click of a button, the `knitr` package converts a $R notebook$ (`.Rmd`) to an intermediary *Markdown* file (`.md`), which $R Studio$ will further transform to various final file types, including [@xie2015]:
* `.pdf` using $LaTeX$ *(beautiful)*
* `.html` using another package called $markdown$ *(highly viewable)*
* `Word` document using Pandoc *(probably be ugly)*
{width=500px}
`knitr` is an engine for dynamic report generation with $R$. It is a package in the statistical programming language $R$ that enables integration of **R code** into $LaTeX$, $LyX$, $HTML$, $Markdown$, $AsciiDoc$, and $text$s documents [@R-knitr].
```{block type='rmdlink', echo=TRUE}
The professionals ar $R Studio$ show it better at their [website](https://rmarkdown.rstudio.com/index.html).
```
-------------
## More Indepth FAQs
```{block type='rmdlink', echo=TRUE}
**Helpful Websites:** [Quick R: Basic Statistics](https://www.statmethods.net/stats/index.html) and [Introduction to R](https://libguides.library.kent.edu/statconsulting/r)
```
### What is R ? {-}
> $R$ is a language and environment for statistical computing and graphics. [@R-base]
$R$ provides a wide variety of **statistical** *(linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...)* and **graphical** techniques, and is highly extensible. The $S$ language is often the vehicle of choice for research in statistical methodology, and $R$ provides an Open Source route to participation in that activity.
One of $R$’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.
### What is R Markdown ? {-}
According to [R Studio](www.rstudio.com):
> "$R Markdown$ is a format that enables easy authoring of reproducible web reports from $R$. It combines the core syntax of Markdown (an easy-to-write *plain text* format for web content) with embedded *$R$ code chunks* that are run so their output can be included in the final document".
### What is Dynamic Reporting? {-}
From [Penn State Statistics](https://onlinecourses.science.psu.edu/statprogram/markdown):
The traditional way to write a report:
1. Run your analysis in software, like SPSS, and manually save our output
* *i.e. saving huge output files with hundreds of pages*
2. Type your your description and interpretation in a text editor, like *Word*,
* *either drag/drop tables or worse retyping all the numbers*
A report written in this way can be problematic. For instance, imagine your *Mentor/collaborator/journal reviewer* telling you that they want to use a sub-sample instead of the entire sample, or exclude three subjects for a specifica reason. Or more likely to include another variable. You would have to redo all of your work!!
If you are using a $R Notebook$, you just change/add a few lines of code and re-run the entire file. Everything gets updated internally. **Hours saved!**
Another bonus is that the single $R Notebook$ file includes exact details of every step: which data file you used, how your cleaned/wrangled your data, and exactly how models were specified. Therefore, in this way **dynamic also means reproducible**, in the sense that people who get the file from you can reproduce the entire work in the report. No guessing which version of your file you used and hunting through stacks of output.
### Is this a popular method for creating reports? {-}
YES!
```{block type='rmdlink', echo=TRUE}
Check out [Rpubs](http://rpubs.com/). This website shares lots of documents written in the way we will introduce below.
```