Skip to content

Lab 02: Transforming Data - R gets stuck processing at mutate()? #29

Description

@SwestCodes

@AntJam-Howell I'm running my code chunk in R to transform my data, but after waiting 10+ minutes, I get the results you see in the first screenshot attached here. After a while, it displays the results - not sure why those are displaying to begin with - and even then it still shows the code is running. I click stop and get the popup notice to terminate R. Could you please offer some assistance here? I am not sure why it seems to be getting stuck.

library(tidycensus)
library(tidyverse)
library(viridis)
library(dplyr)
census_api_key("ada48681b172e752512698d7c4a80ced317e9f34")


#Loading Variables: 
VarSearch <- load_variables(2017, "acs5", cache = TRUE)

head(VarSearch)


dat <- c(Median_Value = "B25097_001", 
          Median_Income = "B19013_001")
CenDF <- get_acs(geography = "county", 
                 year = 2017, 
                 survey = "acs5", 
                 variables = dat,
                 geometry = T)

head(CenDF)

CenDF <- CenDF %>% 
  mutate(variable=case_when(
    variable == "B25097_001" ~ "HouseValue",
    variable == "B19013_001" ~ "HHIncome")) %>% 
  select(-moe) %>% 
  spread(variable, estimate) %>% 
  mutate(HHInc_HousePrice_Ratio = round(HouseValue/HHIncome, 2))
 

image

image

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