This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(targets) | |
| tar_dir({ | |
| #create 10 identical CSVs as a demo | |
| orig <- tibble::tibble(group = c("A", "A", "A", "B", "B", "C"), | |
| value = 1) | |
| purrr::walk(c(1:10), \(x) write_csv(orig, paste0(x, "-data.csv"))) | |
| #_targets.R | |
| tar_script({ | |
| library(targets) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(httr2) | |
| # Requests are composable. For example, you could set a bunch of options in a base request used by many other functions | |
| base_req <- | |
| request("https://services.usanpn.org/npn_portal/") |> | |
| req_retry(max_tries = 3, retry_on_failure = TRUE) |> #retry on errors | |
| req_progress(type = "down") |> #display progress bar for large downloads | |
| req_throttle(rate = 30/60) |> #limit request rate to 30 requests per minute | |
| req_user_agent("rnpn (https://github.com/usa-npn/rnpn/)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(tibble) | |
| library(dplyr) | |
| df <- tibble( | |
| ID = 1:5, | |
| age = c("21-30", "21-30", "31-40", "31-40", "70+"), | |
| hispanic_bin = c(1, 0, 1, 0, 1), | |
| white_bin = c(1, 1, 1, 0, 0), | |
| black_bin = c(0, 0, 0, 1, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(purrr) | |
| library(mirai) | |
| library(carrier) | |
| #launch SLURM jobs | |
| daemons( | |
| n = 3, #number of SLURM jobs to launch | |
| url = host_url()["enp1s0f1np1"], | |
| remote = cluster_config( | |
| command = "sbatch", |
OlderNewer