-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data Visualization basic #18
base: main
Are you sure you want to change the base?
Conversation
- handsome default settings | ||
- snap-together building blocks | ||
- automatic legends, colors, facets | ||
- statistical overlays |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if people will understand what these bullet points mean. Are we assuming that they have experience with base R graphics?
geom_point(aes(x = Depth, y = CTD_O2)) | ||
``` | ||
|
||
Let's check your understanding by visualizing the realtionship between depth and methane using a dot plot. The resulting plot should look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check your understanding by visualizing the realtionship between depth and methane using a dot plot. The resulting plot should look like this: | |
Let's check your understanding by visualizing the relationship between depth and methane using a dot plot. The resulting plot should look like this: |
labs(x="Depth [m]", y="Oxygen [uM]") | ||
``` | ||
|
||
Change the point shape. Similar to color, this can be a single shape or mapped to a variable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mapping colour to a variable wasn't addressed above, so might be best to not bring it up here. You could also cover it in the previous section, though, since it is useful to know.
Change the point shape. Similar to color, this can be a single shape or mapped to a variable: | ||
```{r example4, exercise=TRUE} | ||
ggplot(dat, aes(x = Depth, y = CTD_O2)) + | ||
geom_point(alpha = 0.5, shape = 17) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention that shapes are specified using numbers and provide a link to where they can find the corresponding numbers for shapes.
labs(x="Depth [m]", y="Oxygen [uM]") | ||
``` | ||
|
||
We can summarize the multiple data points as a boxplot by adding the line "geom_boxplot()": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we assume that they know how to read boxplots? Only asking because we had to go over them last week in my 400-level lab course haha
|
||
A list of shape codes can be found [here](http://sape.inf.usi.ch/quick-reference/ggplot2/shape). | ||
|
||
Change the overall look with a theme: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide a link to all of the themes
labs(x="Depth [m]", y="Oxygen [uM]") | ||
``` | ||
|
||
We can visualize the overall mean of all O~2~ values with a horizontal line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe give a brief rationale on why someone should do this (ie. why is denoting where the mean is with a line important)
|
||
* Create dot and box plots in `ggplot2` | ||
* Modify attributes of ggplots | ||
* Complete and interpret the output of ANOVAs in R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ANOVA isn't actually covered in this tutorial
* Complete and interpret the output of ANOVAs in R | ||
|
||
## Setup | ||
Prior to starting this tutorial, please complete the *Pre-module download assignment* to obtain all the necessary software and data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this tutorial a part of a larger curriculum? Where do students go to access the pre-module download assignment?
|
||
Read `4.MICB301_stats_extend_data.csv` into R using `read_csv` and save as `raw_dat`. | ||
```{r} | ||
raw_dat <- geochemicals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's confusing to tell students to save the csv file as raw_dat, but the code saves the object geochemicals to raw_dat instead
## Explore the metadata | ||
In addition to measurements of microbial communities, you also have geochemical data for the Saanich Inlet samples. For a brief introduction to these data, see Hallam SJ et al. 2017. Monitoring microbial responses to ocean deoxygenation in a model oxygen minimum zone. Sci Data 4: 170158 [doi:10.1038/sdata.2017.158](https://www.nature.com/articles/sdata2017158). | ||
|
||
A subset of these data has been provided in `4.MICB301_stats_extend_data.csv` on Canvas including: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also list "Depth" here since you talk about it in the next section
|
||
Using the `%in%` binary operator we can filter for groups of values. Subset data to 3 depths in 7 cruises (i.e. specimens) in February: | ||
```{r} | ||
dat <- filter(dat, Depth %in% c(10, 100, 200), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to have this part be an interactive exercise (assuming we expect students to know basic data wrangling skills)
|
||
A subset of these data has been provided in `4.MICB301_stats_extend_data.csv` on Canvas including: | ||
|
||
- Depth: depth in meters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to explain why you ended up converting this to a factor
#13 adds interactive code chunks and progressive exercises