diff --git a/help.html b/help.html index 96ab803b..61e2f80b 100644 --- a/help.html +++ b/help.html @@ -353,14 +353,14 @@
Here we are creating a new object from an existing one:
new_rivers <- sample(rivers, 5)
new_rivers
-## [1] 300 310 1243 215 1100
+## [1] 2348 600 444 981 338
Using just this will only print the result and not actually change new_rivers
:
new_rivers + 1
-## [1] 301 311 1244 216 1101
+## [1] 2349 601 445 982 339
If we want to modify new_rivers
and save that modified version, then we need to reassign new_rivers
like so:
new_rivers <- new_rivers + 1
new_rivers
-## [1] 301 311 1244 216 1101
+## [1] 2349 601 445 982 339
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.
Make sure you run something like this, with the <-
operator:
rivers2 <- new_rivers + 1
rivers2
-## [1] 302 312 1245 217 1102
+## [1] 2350 602 446 983 340
Perform a t-test to determine if there is evidence of a difference between low birth weight percentage (LowBirthWeight
) in Los Angeles census tracts compared to San Diego:
CaliforniaCounty == "Los Angeles"
CaliforniaCounty == "San Diego"
pull
the LowBirthWeight
column for both subsetst.test
to compare the two pulled vectorstidy
function from the broom
packageLet’s make LowBirthWeight
into a binary variable, where over 5% low birth weight is “TRUE”.
The following code creates a column weight_cat
with TRUE/FALSE values.
ces <- read_csv("https://daseh.org/data/CalEnviroScreen_data.csv")
+## Rows: 8035 Columns: 67
+## ── Column specification ────────────────────────────────────────────────────────
+## Delimiter: ","
+## chr (3): CaliforniaCounty, ApproxLocation, CES4.0PercRange
+## dbl (64): CensusTract, ZIP, Longitude, Latitude, CES4.0Score, CES4.0Percenti...
+##
+## ℹ Use `spec()` to retrieve the full column specification for this data.
+## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
ces_bw <-
ces %>%
mutate(weight_cat = LowBirthWeight > 5)