Skip to content

Commit

Permalink
change to ends_with _code
Browse files Browse the repository at this point in the history
might as well make all area codes change to character for consistency (now including the sa1_7 and sa1_11 columns)
also filter out if code and/or name is null, not just code
  • Loading branch information
peteowen1 authored Feb 7, 2024
1 parent 99f3587 commit 9f28f44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/seifa.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ get_seifa_index_sheet <- function(filename, sheetname, structure = c("sa1", "sa2
col_names = column_names,
na = c("", "NA", "-")
) %>%
dplyr::filter(if_any(ends_with("_code"), ~ !is.na(.x))) %>%
dplyr::filter(if_any(ends_with(c("_name","_code")), ~ !is.na(.x))) %>%
select(-starts_with("blank")) %>%
mutate(
structure = structure,
year = year
) %>%
mutate(across(
.cols = any_of("area_code"), # Specify the column name
.cols = any_of(ends_with("_code")), # Specify the column name
.fns = ~ as.character(.) # Conditionally convert to character
)) %>%
relocate(structure)
Expand Down

0 comments on commit 9f28f44

Please sign in to comment.