Question: ## `patchwork` Make three plots and combine using patchwork. ```{r} ggp_tmax_tmin = weather_df |> ggplot(aes(x = tmin, y = tmax, color = name)) + geom_point(alpha

## `patchwork` Make three plots and combine using patchwork. ```{r} ggp_tmax_tmin = weather_df |> ggplot(aes(x = tmin, y = tmax, color = name)) + geom_point(alpha = 0.5) + theme(legend.position = "none") ggp_prec_density = weather_df |> filter(prcp > 0) |> ggplot(aes(x = prcp, fill = name)) + geom_density(alpha = 0.5) + theme(legend.position = "none") ggp_temp_season = weather_df |> ggplot(aes(x = date, y = tmax, color = name)) + geom_point(alpha = 0.5) + geom_smooth(se = FALSE) + theme(legend.position = "bottom") (ggp_tmax_tmin + ggp_prec_density) / ggp_temp_season ``` ## Data manipulation Let's make temperature violin plots. ```{r} weather_df |> mutate(name = fct_relevel(name, c("Molokai_HI", "CentralPark_NY", "Waterhole_WA"))) |> ggplot(aes(x = name, y = tmax, fill = name)) + geom_violin(alpha = 0.5) ``` ```{r} weather_df |> mutate(name = fct_reorder(name, tmax)) |> ggplot(aes(x = name, y = tmax, fill = name)) + geom_violin(alpha = 0.5) ``` What about data tidiness?? ```{r} pulse_df = haven::read_sas("data/public_pulse_data.sas7bdat") |> janitor::clean_names() |> pivot_longer( bdi_score_bl:bdi_score_12m, names_to = "visit", names_prefix = "bdi_score_", values_to = "bdi" ) |> mutate(visit = fct_inorder(visit)) pulse_df |> ggplot(aes(x = visit, y = bdi)) + geom_boxplot() ```

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock