forked from jaredlander/odsclondon2019
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
154 lines (103 loc) · 4.44 KB
/
Copy pathREADME.Rmd
File metadata and controls
154 lines (103 loc) · 4.44 KB
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
---
output: github_document
params:
className: "Machine Learning and Dashboards in R"
repoName: "odsclondon2019"
repoOwner: "jaredlander"
organizer: "[ODSC London 2019](https://odsc.com/training/portfolio/machine-learning-in-r-part-i-3/)"
packages: !r c('here', 'knitr', 'rmarkdown', 'tidyverse', 'usethis')
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
```{js,echo=FALSE}
code .sourceCode {
white-space: pre-wrap; /* Since CSS 2.1 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
overflow-wrap: break-word;
}
```
```{r settings,echo=FALSE, include=FALSE}
className <- params$className
organizer <- params$organizer
packages <- sort(params$packages)
```
# R Class
This is an empty repo to initialize an R project for class at by `r organizer`.
Please __follow all instructions__ to set up your environment for the training.
# Install R and RStudio
This is just like installing any other program.
- [R](https://cloud.r-project.org/)
- [RStudio](https://www.rstudio.com/products/rstudio/download/#download)
# Getting the Repo
In order to get the most out of class you have to be working in this project. There are three ways to get this project on your computer.
Choose __one of these methods__.
1. Clone the repo using the command line
1. Clone the repo using the RStudio GUI
1. Use the [`{usethis}`](https://usethis.r-lib.org) package to download and unzip the repo
## Command Line
This assumes you have `git` [installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).^[Can also be done with ssh instead of https.]
Run this command in the command line or shell.
```sh
git clone `r sprintf("https://github.com/%s/%s.git", params$repoOwner, params$repoName)`
```
Then open the ``r sprintf("%s.Rproj", params$repoName)`` file.
## RStudio Gui
This assumes you have `git` [installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
Click `File > New Project`.
```{r new-project-click,echo=FALSE}
knitr::include_graphics('images/rstudio-project-menu.png')
```
Click `Version Control`.
```{r version-control-click,echo=FALSE}
knitr::include_graphics('images/rstudio-create-project.png')
```
Click `Git`.
```{r git-click,echo=FALSE}
knitr::include_graphics('images/rstudio-create-project-version-control.png')
```
Choose a folder in the `Create project as a subdirectory of` field.
Paste ``r sprintf('https://github.com/%s/%s', params$repoOwner, params$repoName)``^[Or ``r sprintf('git@github.com:%s/%s.git', params$repoOwner, params$repoName)`` for ssh.] in the `Repository URL` field.
```{r paste-url,echo=FALSE}
knitr::include_graphics('images/rstudio-create-project-git.png')
```
## `usethis` Package
Run these commands in the R console.
```r
# install usethis package
install.packages('usethis')
# get the repo
usethis::use_course('https://github.com/`r params$repoOwner`/`r params$repoName`/archive/master.zip')
```
Be sure to select the positive prompts such as `yes`, `yeah`, etc.
This will open the project in a new RStudio window.
After any of these methods you should have a new RStudio project called ``r params$repoName`` or ``r sprintf("%s-master", params$repoName)``. You can see this in the top right of RStudio (the name in the image may be different).
```{r proj-corner,echo=FALSE}
knitr::include_graphics('images/ProjectCorner.png')
```
# Install Packages
Setting up all of the needed packages^[Linux users might need to install `libxml2-dev` and `zlib1g-dev`] will be handled by running the following line of code in the R console.
```{r source-install,eval=FALSE}
source('prep/install_packages.r')
```
Answer `y` to any questions asked in the terminal.
If that fails, instaling `{tidyverse}` with the following code will suffice to get started.
```{r install-tidyverse,eval=FALSE}
install.packages('tidyverse')
```
# Getting Data
The data are stored in a [GitHub repo](https://github.com/jaredlander/coursedata) and can be downloaded automatically with the following line of code, assuming all of the packages installed successfully.
```{r download-data,eval=FALSE}
source('prep/download_data.r')
```
# All Done
That's everything. You should now do all of your work for this class in this project.
# Footnotes