Skip to content

Commit

Permalink
Render site
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 12, 2024
1 parent 052ebea commit fb6781c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 58 deletions.
8 changes: 4 additions & 4 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,16 @@ <h2><strong>Why are my changes not taking effect? It’s making my results
<p>Here we are creating a new object from an existing one:</p>
<pre class="r"><code>new_rivers &lt;- sample(rivers, 5)
new_rivers</code></pre>
<pre><code>## [1] 383 760 1100 1459 250</code></pre>
<pre><code>## [1] 529 246 291 540 237</code></pre>
<p>Using just this will only print the result and not actually change
<code>new_rivers</code>:</p>
<pre class="r"><code>new_rivers + 1</code></pre>
<pre><code>## [1] 384 761 1101 1460 251</code></pre>
<pre><code>## [1] 530 247 292 541 238</code></pre>
<p>If we want to modify <code>new_rivers</code> and save that modified
version, then we need to reassign <code>new_rivers</code> like so:</p>
<pre class="r"><code>new_rivers &lt;- new_rivers + 1
new_rivers</code></pre>
<pre><code>## [1] 384 761 1101 1460 251</code></pre>
<pre><code>## [1] 530 247 292 541 238</code></pre>
<p>If we forget to reassign this can cause subsequent steps to not work
as expected because we will not be working with the data that has been
modified.</p>
Expand Down Expand Up @@ -484,7 +484,7 @@ <h2><strong>Error: object ‘X’ not found</strong></h2>
operator:</p>
<pre class="r"><code>rivers2 &lt;- new_rivers + 1
rivers2</code></pre>
<pre><code>## [1] 385 762 1102 1461 252</code></pre>
<pre><code>## [1] 531 248 293 542 239</code></pre>
<hr />
</div>
<div id="error-unexpected-in-error-unexpected-in-error-unexpected-x-in"
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ <h2>Find an Error!?</h2>
associated with the class: <a
href="https://github.com/jhudsl/intro_to_r"
class="uri">https://github.com/jhudsl/intro_to_r</a></p>
<p>This page was last updated on 2024-07-10.</p>
<p>This page was last updated on 2024-07-12.</p>
<p style="text-align:center;">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://live.staticflickr.com/4557/26350808799_6f9c8bcaa2_b.jpg" height="150"/>
</a>
Expand Down
41 changes: 21 additions & 20 deletions modules/RStudio/lab/RStudio_Lab.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,29 @@ Now we will install some packages! Note it may take ~5-10 minutes to run all the

### 0.1

First copy and paste the following code into the console (the lower left panel/pane) - **but do not copy the backticks**: <br>
`install.packages("remotes")`<br>
First copy and paste the following code into the console (the lower left panel/pane):
install.packages("remotes")

This code will install a package from CRAN called "remotes". <br>
You may be asked a question in the console when you do this. If so, answer by typing Yes into the console.

### 0.2

Next copy and paste the following code again into the console (the lower left panel/pane), **again do not copy the backticks**: <br>
`library(remotes)` <br>
Next copy and paste the following code again into the console (the lower left panel/pane):
library(remotes)

This code loads the remotes package into memory- in other words we can use the functions within the package.<br>
You may be asked a question in the console when you do this. If so, answer by typing Yes into the console.

### 0.3

Now install a package that the instructors made that is not on CRAN but on GitHub, by copy and pasting the code into the console. We still don't want to copy the backticks.<br>
`install_github("jhudsl/jhur")`<br>
Now install a package that the instructors made that is not on CRAN but on GitHub, by copy and pasting the code into the console:

install_github("jhudsl/jhur")

You may be asked a question in the console when you do this. If so, answer by typing Yes into the console.

### 0.4

The gray area below is a code chunk that will set up our packages and data (this will not show up in the rendered report when we press knit). You can also run the code within the editor area by pressing the green play button. Don't worry right now about what the code is doing, we will cover this later. We just want you to get used to RStudio and RMarkdowns.

Expand Down Expand Up @@ -62,10 +67,8 @@ The console is useful for installing packages like we just did, this is because

## Plotting some data

Here is code that will make a plot of the average daily ridership in Baltimore City for the Charm City Circulator: https://www.charmcitycirculator.com/ (again don't worry about the actually code much for now).


Here we plot a few days. You can embed an R code chunk like this: Try pressing the green play button to see what happens. Make sure you have run the previous code chunk first by pressing the green play button in that chunk.
Here is code that will make a plot of some data.
You can embed an R code chunk like this: Try pressing the green play button to see what happens. Make sure you have run the previous code chunk first by pressing the green play button in that chunk.

```{r plot_circ, out.width = "100%"}
# keep only some days
Expand Down Expand Up @@ -96,23 +99,23 @@ When code is in an RMarkdown file chunk, it is saved to a file. When it is in th

The console is useful for installing packages like we just did, this is because we only need to do it once, so we don't usually need to save the code.


## Exercise

Here are a few changes that will show you how to change small things in `R` code and the output it makes. After each change, hit the **Knit** button again.

Here is another code chunk for our exercises.

```{r}
x <- c(1, 2, 3)
```

### 1.1

Go through the code for the plot above and change the colors in `palette` to something other than what they originally were. See http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a large list of colors. For example, you could replace blue with red.

### 1.2

Add a new R chunk below the bonus instructions.You can use the insert chunk button or copy paste an existing code chunk. Include a lowercase x inside the chunk as the code. Thus it should look like the chunk above but without `<- c(1,2,3)`. Make sure you press the knit button after this to see what the new chunk looks like.
Add a new R chunk below the following chunk. You can use the insert chunk button or copy paste an existing code chunk. Include a lowercase x inside the chunk as the code. Make sure you press the knit button after this to see what the new chunk looks like.


```{r}
x <- c(1, 2, 3)
```


# Practice on Your Own!
Expand All @@ -125,8 +128,6 @@ Update the options of the R chunk you just made (with the lowercase x in it) so

Create another R Markdown Document from RStudio dropdowns: File → New File → R Markdown.



```{r echo=FALSE, label = '2response'}
```{r echo=FALSE, label = 'P.2response'}
```
61 changes: 28 additions & 33 deletions modules/RStudio/lab/RStudio_Lab_Key.html

Large diffs are not rendered by default.

0 comments on commit fb6781c

Please sign in to comment.