Skip to content

Lab 05 #17

Description

@etbartell

Is anyone else having an issue in Part 3 where the acs and acs12 dataframes get collapsed to a single number when you use the summarise function? It seems to have just disregarded every command above the last one.
Here's the code I used:

acs <- 
  acs %>%
  mutate( id = str_extract(variable, "[0-9]{3}$") %>% as.integer ) %>%
  # variable 1 is the "total", which is just the sum of the others
  filter(id > 1) %>%
  mutate(education = case_when(
    id %>% between(2, 16) ~ "No HS diploma",
    id %>% between(17, 21) ~ "HS, no Bachelors",
    id > 21 ~ "At Least a Bachelors"
  )) %>% 
  group_by(GEOID, education) %>% 
  summarise(estimate = sum(estimate))

Then here's what it did to the dataframe:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions