Convert the airquality
dataset (from the datasets package) to a tibble and create a scatterplot with a smooth line showing the relationship between temperature and ozone levels for each month in the dataset. You may find the following functions helpful in this process:
facet_wrap
to make a faceted plot
vars
to define which variable to use for facets
drop_na
to remove rows with NA values in certain columns
as.character
to coerce numbers or other data types to character values
Facets are not treated as part of the aesthetic mapping in aes
. One way to relabel these is to use fct_recode
inside the vars
function to change the factor names.
For the same reason, we can’t access facet axis scales using any scales_*
functions. We can modify these in the facet_wrap
function with the scales argument.
We can change a single scale with the argument “free_x” or “free_y”.
aq<-as_tibble(airquality)
ggplot(drop_na(aq,Temp,Ozone),aes(x=Temp,y=Ozone)) +
geom_point() +
geom_smooth() +
facet_wrap(vars(fct_recode(as.character(Month),May="5",June="6",July="7",August="8",September="9")),scales="free_x")
Editing facet axis scales
Passive acoustic monitoring
Passive acoustic monitoring
Navigating R Studio
Data objects and file systems in R
Finding data and getting help
Visualizing different kinds of data with ggplot2
Exploratory data analysis
From data handling to data wrangling with dplyr
Finer control with ggplot2
and friends
Spatial data analysis and visualization
Data modeling
Why would we want science to be reproducible?
Code will do precisely what we want, but it will not necessarily understood by others.
An approach to writing software that centers the human user (and re-user) by combining natural language explanations with code.
A code notebook is software tool for literate programming.
Quarto is a data science documentation and publishing system that comes built-in to RStudio.
Download the PalmersPenguins.qmd file from Canvas. Try modifying the code, text, and titles in the document. You can also add your own Code Chunk using the button indicated below:
How to create Quarto documents and integrate them into our process
Revisit Weeks 1 - 4
Brainstorm ideas for final projects