This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## %######################################################%## | |
| # # | |
| #### Letter case - your turn #### | |
| # # | |
| ## %######################################################%## | |
| # Import the Marine Protected Areas dataset (MPAS-your.csv) | |
| # Summarize the number of Marine Protected Areas by country (Country full). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| third_grade_math_proficiency_18_19 <- read_excel(path = here("data", "math-scores-18-19.xlsx")) %>% | |
| filter(student_group == "Total Population (All Students)") %>% | |
| filter(grade_level == "Grade 3") %>% | |
| select(school_id, contains("number")) %>% | |
| pivot_longer(cols = contains("number"), | |
| names_to = "proficiency_level", | |
| values_to = "number_proficient") %>% | |
| mutate(number_proficient = na_if(number_proficient, "*")) %>% | |
| mutate(number_proficient = na_if(number_proficient, "--")) %>% | |
| mutate(number_proficient = as.numeric(number_proficient)) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Hi Expensify, | |
| Don’t hire me. I don’t have the background you’re expecting. At all. | |
| I’ve never done “customer service.” I’ve never worked in a business. I’ve never used Expensify. | |
| My career stops have included: second grade teacher, PhD in anthropology, college professor, and researcher at a foundation. | |
| So I’m seriously probably the worst candidate you could ever imagine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iris %>% | |
| group_by(Species) %>% | |
| summarize(mean_petal_width = mean(Petal.Width)) %>% | |
| ungroup() %>% | |
| ggplot(aes(Species, mean_petal_width, | |
| fill = Species)) + | |
| geom_col(show.legend = FALSE) + | |
| theme_ipsum() + | |
| scale_fill_manual(values = c("setosa" = "lightgray", | |
| "versicolor" = "lightgray", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iris %>% | |
| group_by(Species) %>% | |
| summarize(mean_petal_width = mean(Petal.Width)) %>% | |
| ungroup() %>% | |
| ggplot(aes(Species, mean_petal_width)) + | |
| geom_col() + | |
| theme_ipsum() + | |
| labs(x = NULL, | |
| y = NULL, | |
| title = "Average petal width of irises by species") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Name | Upward Mobility: Percent of People from Low-Income Families (25th Percentile) who Grow up to be High Income (Top 20%)* | |
|---|---|---|
| Baker County, OR | 12.00% | |
| Benton County, OR | 13.41% | |
| Clackamas County, OR | 13.21% | |
| Clatsop County, OR | 12.26% | |
| Columbia County, OR | 11.11% | |
| Coos County, OR | 9.70% | |
| Crook County, OR | 10.75% | |
| Curry County, OR | 10.36% | |
| Deschutes County, OR | 11.08% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| outputs <- read_excel(path = "data-raw/outputs_profservcices.xlsx") %>% | |
| mutate(hours_counted = case_when( | |
| activity == "Output" ~ hours, | |
| activity == "A la Carte Referral" & prosper_approved == "Yes" ~ hours, | |
| activity == "SBLC Referral" & accepted == "Yes" ~ hours, | |
| activity == "MFS Referral" & accepted == "Yes" ~ hours, | |
| activity == "MarketLink Referral" & accepted == "Yes" ~ hours | |
| )) %>% | |
| mutate(activity_categorized = case_when( | |
| activity == "Output" ~ "Output", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| diamonds_summary <- diamonds %>% | |
| count(cut) %>% | |
| mutate(cut = factor(cut, levels = c("Fair", | |
| "Good", | |
| "Very Good", | |
| "Premium", | |
| "Ideal"))) %>% | |
| mutate(cut = fct_rev(cut)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dk_summarize_with_totals <- function(.data, group_by_var, mean_var){ | |
| groups_summary <- .data %>% | |
| dplyr::group_by({{ group_by_var }}) %>% | |
| dplyr::summarize(mean = mean({{ mean_var }})) %>% | |
| dplyr::rename("group" = {{ group_by_var }} ) | |
| overall_summary <-.data %>% | |
| dplyr::summarize(mean = mean({{ mean_var }})) %>% | |
| dplyr::mutate(group = "Total") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ggplot(sleep_by_gender, | |
| aes(gender, | |
| avg_sleep, | |
| fill = gender)) + | |
| geom_col() |
NewerOlder