From eb3c7be4300c07e4761ce8faa2a48d9da7c33b2b Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" Here we are creating a new object from an existing one: Using just this will only print the result and not actually change
If we want to modify 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.Why are my changes not taking effect? It’s making my results
-new_rivers <- sample(rivers, 5)
new_rivers
+## [1] 529 246 291 540 237
## [1] 310 325 900 1770 217
new_rivers
:
-new_rivers + 1
+## [1] 530 247 292 541 238
## [1] 311 326 901 1771 218
new_rivers
and save that modified
version, then we need to reassign new_rivers
like so:
-new_rivers <- new_rivers + 1
new_rivers
+## [1] 530 247 292 541 238
## [1] 311 326 901 1771 218
Error: object ‘X’ not found
operator:
rivers2 <- new_rivers + 1
rivers2
-## [1] 531 248 293 542 239
+## [1] 312 327 902 1772 219
First copy and paste the following code into the console (the lower
-left panel/pane) - but do not copy the backticks:
-install.packages("remotes")
This code will install a
-package from CRAN called “remotes”.
You may be asked a question in
-the console when you do this. If so, answer by typing Yes into the
-console.
This code will install a package from CRAN called “remotes”.
You
+may be asked a question in the console when you do this. If so, answer
+by typing Yes into the console.
Next copy and paste the following code again into the console (the
-lower left panel/pane), again do not copy the
-backticks:
library(remotes)
This code
-loads the remotes package into memory- in other words we can use the
-functions within the package.
You may be asked a question in the
-console when you do this. If so, answer by typing Yes into the
-console.
This code loads the remotes package into memory- in other words we
+can use the functions within the package.
You may be asked a
+question in the console when you do this. If so, answer by typing Yes
+into the console.
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.
-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.
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.
+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 @@ -423,13 +423,10 @@
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.
# keep only some days
avg <- avg %>%
filter(day %in% c("Monday", "Tuesday", "Friday", "Saturday"))
@@ -462,9 +459,7 @@ 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.
-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.
@@ -472,13 +467,13 @@
1.1
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
+
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. 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.
+inside the chunk as the code. Make sure you press the knit button after
+this to see what the new chunk looks like.
+x <- c(1, 2, 3)