- Oct 2024
-
rsginc.github.io rsginc.github.io
-
left_join(tbi$hh) %>%
As written it will return NA for entire sample_segment column. Instead put left_join(tbi$hh, by = c("survey_year", "hh_id")) %>%
-
left_join(tbi$hh, by = "hh_id") %>%
If you join it like this, survey_year will become survey_year.x. Instead do left_join(tbi$hh, by = c("hh_id", "survey_year")) %>%
-
left_join(tbi$hh, by = "hh_id") %>%
If you join it like this, survey_year will become survey_year.x. Instead do left_join(tbi$hh, by = c("hh_id", "survey_year")) %>%
-
left_join(tbi$hh, by = "hh_id") %>%
If you join it like this, survey_year will become survey_year.x. Instead do left_join(tbi$hh, by = c("hh_id", "survey_year")) %>%
-
mode_type = value_labels_upcoded[variable == "mode_type", value],
mode_type = values_list[variable_unified == "mode_type", value_upcoded],
-
tab <- tbi$person %>% left_join(tbi$hh, by = "hh_id") %>% filter(survey_year == 2023) %>% group_by(home_county, job_type_pre_covid) %>% summarize(wtd_population = sum(person_weight)) %>% ungroup() %>% group_by(home_county) %>% mutate(wtd_prop_population = wtd_population / sum(wtd_population))
Joining like this will cause the column for survey_year to become survey_year.x. Instead join by both hh_id and survey_year. left_join(tbi$hh, by = c("hh_id", "survey_year") %>%
-
gt::fmt_number(columns = c(2:4), decimals = 0) %>% gt::fmt_percent(columns = c(5:6), decimals = 1)
With extra home county column (column 1) need to move over one c(2:4) -> c(3:5) and c(5:6) -> c(6:7)
-
group_by(income_broad) %>%
group_by(home_county, income_broad) %>% need to keep home county column for later
-
description
description_unified
-
left_join(nt_desc3, by = "variable")
left_join(nt_desc3, by = c("variable" = "variable_unified"))
-
description = str_replace( description
Change description to description_unified
-
description
Change to description_unified
-
description
Change to description_unified
-
nt_desc <- filter(variable_list, str_detect(variable, "no_travel")) %>% select(variable, description)
The column has been changed from variable to variable_unified and from description to description_unified
-
weighted_hhs <- tbi$hh[!is.na(hh_weight) & hh_weight > 0, hh_id] tbi <- lapply( tbi, function(dt) { dt <- dt[hh_id %in% weighted_hhs] } )
The new data includes 10 elements instead of 8. To align them first create variable_list <- tbi$metaData_variables and values_list <- tbi$metaData_values before deleting the two additional elements tbi<- tbi[1:8]
-
Getting Started
It would be nice for a list of all packages that will be used so we can activate them.
-