Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading used address file method #8

Open
tomwilsonsco opened this issue Jun 13, 2024 · 0 comments
Open

Reading used address file method #8

tomwilsonsco opened this issue Jun 13, 2024 · 0 comments
Assignees

Comments

@tomwilsonsco
Copy link
Member

Alternatives to this process (NOTE: It looks like process has changed slightly since I wrote the alternative methods, so they might not work exactly as written anymore):

do.call(rbind, pblapply(seq_along(previous.sas.samples.path),
function(x)
transform(
haven::read_sas(previous.sas.samples.path[x],
col_select = "UDPRN"),
filename = previous.sas.samples.path[x]))) %>%
clean_names_modified()
list_used_addresses <- c(list_used_addresses, list(prev.sas.samples))
}

  1. Using purrr as used elsewhere in the project anyway:
usedaddresses <- previoussamples.path %>%
  purrr::map(\(x) haven::read_sas(x, col_select = "UDPRN") %>%
    mutate(survey = x), .progress = TRUE) %>%
  purrr::list_rbind()
  1. Using furrr
future::plan(future::multisession, workers = 8)

usedaddresses <- previoussamples.path %>%
  furrr::future_map_dfr(\(x) haven::read_sas(x, col_select = "UDPRN") %>%
    mutate(survey = x), .progress = TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants