Skip to content

Commit 0b708e8

Browse files
committed
Small fixes.
* Fix link to best practices lesson. * Update exercise solution in instructor's guide
1 parent 7c7ad24 commit 0b708e8

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h2 id="topics">Topics</h2>
5353
<li><a href="03-loops-R.html">Analyzing multiple data sets</a></li>
5454
<li><a href="04-cond.html">Making choices</a></li>
5555
<li><a href="05-cmdline.html">Command-Line Programs</a></li>
56-
<li><a href="06-best-practices.html">Best practices for using R and designing programs</a></li>
56+
<li><a href="06-best-practices-R.html">Best practices for using R and designing programs</a></li>
5757
<li><a href="07-knitr-R.html">Dynamic reports with knitr</a></li>
5858
<li><a href="08-making-packages-R.html">Making packages in R</a></li>
5959
</ol>

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ and to use that language *well*.
3535
3. [Analyzing multiple data sets](03-loops-R.html)
3636
4. [Making choices](04-cond.html)
3737
5. [Command-Line Programs](05-cmdline.html)
38-
6. [Best practices for using R and designing programs](06-best-practices.html)
38+
6. [Best practices for using R and designing programs](06-best-practices-R.html)
3939
7. [Dynamic reports with knitr](07-knitr-R.html)
4040
8. [Making packages in R](08-making-packages-R.html)
4141

instructors.Rmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ An additional half-day could add the next two lessons:
7171

7272
Time-permitting, you can fit in one of these shorter lessons that cover bigger picture ideas like best practices for organizing code, reproducible research, and creating packages:
7373

74-
6. [Best practices for using R and designing programs](06-best-practices.html)
74+
6. [Best practices for using R and designing programs](06-best-practices-R.html)
7575
7. [Dynamic reports with knitr](07-knitr-R.html)
7676
8. [Making packages in R](08-making-packages-R.html)
7777

@@ -85,13 +85,13 @@ Time-permitting, you can fit in one of these shorter lessons that cover bigger p
8585

8686
```{r}
8787
dat <- read.csv("data/inflammation-01.csv", header = FALSE)
88-
element <- c("o", "x", "y", "g", "e", "n")
88+
animal <- c("m", "o", "n", "k", "e", "y")
8989
# Challenge - Slicing (subsetting data)
90-
element[4:1] # first 4 characters in reverse order
91-
element[-1] # remove first character
92-
element[-4] # remove fourth character
93-
element[-1:-4] # remove firts to fourth characters
94-
element[c(5, 1, 6)] # new character vector
90+
animal[4:1] # first 4 characters in reverse order
91+
animal[-1] # remove first character
92+
animal[-4] # remove fourth character
93+
animal[-1:-4] # remove first to fourth characters
94+
animal[c(5, 2, 3)] # new character vector
9595
# Challenge - Subsetting data
9696
max(dat[5, 3:7])
9797
```

instructors.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2 id="overall">Overall</h2>
4848
</ol>
4949
<p>Time-permitting, you can fit in one of these shorter lessons that cover bigger picture ideas like best practices for organizing code, reproducible research, and creating packages:</p>
5050
<ol start="6" style="list-style-type: decimal">
51-
<li><a href="06-best-practices.html">Best practices for using R and designing programs</a></li>
51+
<li><a href="06-best-practices-R.html">Best practices for using R and designing programs</a></li>
5252
<li><a href="07-knitr-R.html">Dynamic reports with knitr</a></li>
5353
<li><a href="08-making-packages-R.html">Making packages in R</a></li>
5454
</ol>
@@ -58,21 +58,21 @@ <h2 id="analyzing-patient-data"><a href="01-starting-with-data.html">Analyzing P
5858
<li><p>Provide shortcut for the assignment operator (<code>&lt;-</code>) (RStudio: Alt+- on Windows/Linux; Option+- on Mac)</p></li>
5959
</ul>
6060
<pre class="sourceCode r"><code class="sourceCode r">dat &lt;-<span class="st"> </span><span class="kw">read.csv</span>(<span class="st">&quot;data/inflammation-01.csv&quot;</span>, <span class="dt">header =</span> <span class="ot">FALSE</span>)
61-
element &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;o&quot;</span>, <span class="st">&quot;x&quot;</span>, <span class="st">&quot;y&quot;</span>, <span class="st">&quot;g&quot;</span>, <span class="st">&quot;e&quot;</span>, <span class="st">&quot;n&quot;</span>)
61+
animal &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;m&quot;</span>, <span class="st">&quot;o&quot;</span>, <span class="st">&quot;n&quot;</span>, <span class="st">&quot;k&quot;</span>, <span class="st">&quot;e&quot;</span>, <span class="st">&quot;y&quot;</span>)
6262
<span class="co"># Challenge - Slicing (subsetting data)</span>
63-
element[<span class="dv">4</span>:<span class="dv">1</span>] <span class="co"># first 4 characters in reverse order</span></code></pre>
64-
<pre class="output"><code>[1] &quot;g&quot; &quot;y&quot; &quot;x&quot; &quot;o&quot;
63+
animal[<span class="dv">4</span>:<span class="dv">1</span>] <span class="co"># first 4 characters in reverse order</span></code></pre>
64+
<pre class="output"><code>[1] &quot;k&quot; &quot;n&quot; &quot;o&quot; &quot;m&quot;
6565
</code></pre>
66-
<pre class="sourceCode r"><code class="sourceCode r">element[-<span class="dv">1</span>] <span class="co"># remove first character</span></code></pre>
67-
<pre class="output"><code>[1] &quot;x&quot; &quot;y&quot; &quot;g&quot; &quot;e&quot; &quot;n&quot;
66+
<pre class="sourceCode r"><code class="sourceCode r">animal[-<span class="dv">1</span>] <span class="co"># remove first character</span></code></pre>
67+
<pre class="output"><code>[1] &quot;o&quot; &quot;n&quot; &quot;k&quot; &quot;e&quot; &quot;y&quot;
6868
</code></pre>
69-
<pre class="sourceCode r"><code class="sourceCode r">element[-<span class="dv">4</span>] <span class="co"># remove fourth character</span></code></pre>
70-
<pre class="output"><code>[1] &quot;o&quot; &quot;x&quot; &quot;y&quot; &quot;e&quot; &quot;n&quot;
69+
<pre class="sourceCode r"><code class="sourceCode r">animal[-<span class="dv">4</span>] <span class="co"># remove fourth character</span></code></pre>
70+
<pre class="output"><code>[1] &quot;m&quot; &quot;o&quot; &quot;n&quot; &quot;e&quot; &quot;y&quot;
7171
</code></pre>
72-
<pre class="sourceCode r"><code class="sourceCode r">element[-<span class="dv">1</span>:-<span class="dv">4</span>] <span class="co"># remove firts to fourth characters</span></code></pre>
73-
<pre class="output"><code>[1] &quot;e&quot; &quot;n&quot;
72+
<pre class="sourceCode r"><code class="sourceCode r">animal[-<span class="dv">1</span>:-<span class="dv">4</span>] <span class="co"># remove first to fourth characters</span></code></pre>
73+
<pre class="output"><code>[1] &quot;e&quot; &quot;y&quot;
7474
</code></pre>
75-
<pre class="sourceCode r"><code class="sourceCode r">element[<span class="kw">c</span>(<span class="dv">5</span>, <span class="dv">1</span>, <span class="dv">6</span>)] <span class="co"># new character vector</span></code></pre>
75+
<pre class="sourceCode r"><code class="sourceCode r">animal[<span class="kw">c</span>(<span class="dv">5</span>, <span class="dv">2</span>, <span class="dv">3</span>)] <span class="co"># new character vector</span></code></pre>
7676
<pre class="output"><code>[1] &quot;e&quot; &quot;o&quot; &quot;n&quot;
7777
</code></pre>
7878
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Challenge - Subsetting data</span>

instructors.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ An additional half-day could add the next two lessons:
6969

7070
Time-permitting, you can fit in one of these shorter lessons that cover bigger picture ideas like best practices for organizing code, reproducible research, and creating packages:
7171

72-
6. [Best practices for using R and designing programs](06-best-practices.html)
72+
6. [Best practices for using R and designing programs](06-best-practices-R.html)
7373
7. [Dynamic reports with knitr](07-knitr-R.html)
7474
8. [Making packages in R](08-making-packages-R.html)
7575

@@ -84,61 +84,61 @@ Time-permitting, you can fit in one of these shorter lessons that cover bigger p
8484

8585
~~~{.r}
8686
dat <- read.csv("data/inflammation-01.csv", header = FALSE)
87-
element <- c("o", "x", "y", "g", "e", "n")
87+
animal <- c("m", "o", "n", "k", "e", "y")
8888
# Challenge - Slicing (subsetting data)
89-
element[4:1] # first 4 characters in reverse order
89+
animal[4:1] # first 4 characters in reverse order
9090
~~~
9191

9292

9393

9494
~~~{.output}
95-
[1] "g" "y" "x" "o"
95+
[1] "k" "n" "o" "m"
9696
9797
~~~
9898

9999

100100

101101
~~~{.r}
102-
element[-1] # remove first character
102+
animal[-1] # remove first character
103103
~~~
104104

105105

106106

107107
~~~{.output}
108-
[1] "x" "y" "g" "e" "n"
108+
[1] "o" "n" "k" "e" "y"
109109
110110
~~~
111111

112112

113113

114114
~~~{.r}
115-
element[-4] # remove fourth character
115+
animal[-4] # remove fourth character
116116
~~~
117117

118118

119119

120120
~~~{.output}
121-
[1] "o" "x" "y" "e" "n"
121+
[1] "m" "o" "n" "e" "y"
122122
123123
~~~
124124

125125

126126

127127
~~~{.r}
128-
element[-1:-4] # remove firts to fourth characters
128+
animal[-1:-4] # remove first to fourth characters
129129
~~~
130130

131131

132132

133133
~~~{.output}
134-
[1] "e" "n"
134+
[1] "e" "y"
135135
136136
~~~
137137

138138

139139

140140
~~~{.r}
141-
element[c(5, 1, 6)] # new character vector
141+
animal[c(5, 2, 3)] # new character vector
142142
~~~
143143

144144

0 commit comments

Comments
 (0)