Skip to content

Commit

Permalink
Merge pull request #1005 from garezana/patch-8
Browse files Browse the repository at this point in the history
Update Functions-writing-tidyverse-functions-R.md
  • Loading branch information
ethanwhite authored Oct 20, 2023
2 parents 9d97055 + 53aa1a2 commit 32707a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exercises/Functions-writing-tidyverse-functions-R.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Writing Tidyverse Functions
language: R
---

1\. Copy the following vectors into R and combine them into a data frame named `count_data` with columns named `state`, `count`, and `area`.
1\. Copy the following vectors into R and combine them into a data frame named `count_data` with columns named `state`, `count`, `area`, and `site`.

```r
state_vector <- c("FL", "FL", "FL", "FL", "GA", "GA", "GA", "GA", "SC", "SC", "SC", "SC")
Expand All @@ -16,4 +16,4 @@ area_vector <- c(3, 5, 1.9, 2.7, 2, 2.6, 6.2, 4.5, 8, 4, 1, 3)

2\. Write a function takes takes two arguments: 1) a data frame with a `count` column and an `area` column; and 2) a column in that data frame to color the points by. Have the function make a plot with `area` on the x-axis and `count` on the y-axis and the points colored by the column you provided as an argument. Set the size of the points to 3. Use the function to make a scatter plot of count as a function of area for the `count_data` data frame with the points colored by the `state` column.

3\. Use the function from (2) to make a scatter plot of count as a function of area for the `count_data` data frame with the points colored by the `site` column.
3\. Use the function from (2) to make a scatter plot of count as a function of area for the `count_data` data frame with the points colored by the `site` column.

0 comments on commit 32707a5

Please sign in to comment.