Skip to content

Commit 7a01903

Browse files
committed
fix logic error in code
1 parent f4cf929 commit 7a01903

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

materials/sections/r-practice-owner-visualize.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ First, you'll need to create a new dataset subset called `lobsters_summarize`:
6464
#| code-summary: "Answer"
6565
lobsters_summarize <- lobster_abundance %>%
6666
group_by(SITE, YEAR) %>%
67-
summarize(COUNT = n())
67+
summarize(COUNT = sum(COUNT, na.rm = TRUE))
6868
```
6969

7070
Next, create a line graph using `ggplot()` and `geom_line()`. Use `geom_point()` to make the data points more distinct, but ultimately up to you if you want to use it or not. We also want `SITE` information on this graph, do this by specifying the variable in the `color` argument. Where should the `color` argument go? Inside or outside of `aes()`? Why or why not?
@@ -108,7 +108,7 @@ lobster_size_lrg <- lobster_abundance %>%
108108
filter(YEAR %in% c(2019, 2020, 2021)) %>%
109109
mutate(SIZE_BIN = if_else(SIZE_MM <= 70, true = "small", false = "large")) %>%
110110
group_by(SITE, SIZE_BIN) %>%
111-
summarize(COUNT = n()) %>%
111+
summarize(COUNT = sum(COUNT, na.rm = TRUE))
112112
drop_na()
113113
```
114114

0 commit comments

Comments
 (0)