Title: | Tan's Helper Functions for Advent of Code |
---|---|
Description: | Helpers for downloading Advent of Code answers. Eventually will help submit also? |
Authors: | Tan Ho [aut, cre] |
Maintainer: | Tan Ho <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.15.0 |
Built: | 2024-10-03 02:42:11 UTC |
Source: | https://github.com/tanho63/aoc.elf |
Requires AOC_COOKIE environment variable to be set. Downloads and caches puzzle inputs onto your machine.
aoc_get( day, year = format(Sys.Date(), "%Y"), path = here::here(), overwrite = FALSE, open = Sys.getenv("AOC_OPEN", unset = interactive()) )
aoc_get( day, year = format(Sys.Date(), "%Y"), path = here::here(), overwrite = FALSE, open = Sys.getenv("AOC_OPEN", unset = interactive()) )
day |
the day of the puzzle |
year |
year of puzzle, defaults to current year |
path |
path to copy template to, defaults to subfolders of current directory |
overwrite |
overwrite existing file, default to interactive() |
Returns the timestamp, in case you're keen on timing your results.
This function copies the bundled RMarkdown template into a folder within the (current) path, creating a subfolder for the year if necessary and pre-filling variables
aoc_init( day, year = format(Sys.Date(), "%Y"), path = here::here(), overwrite = FALSE, template = Sys.getenv("AOC_TEMPLATE", unset = "default"), open = Sys.getenv("AOC_OPEN", unset = "true") )
aoc_init( day, year = format(Sys.Date(), "%Y"), path = here::here(), overwrite = FALSE, template = Sys.getenv("AOC_TEMPLATE", unset = "default"), open = Sys.getenv("AOC_OPEN", unset = "true") )
day |
the day of the puzzle |
year |
year of puzzle, defaults to current year |
path |
path to copy template to, defaults to subfolders of current directory |
overwrite |
overwrite existing file, default to FALSE |
open |
open file for editing, if RStudio is available |
opens the template
Reads in input lines into a tibble and optionally tries type detection
aoc_read(day, year = format(Sys.Date(), "%Y"), convert = TRUE)
aoc_read(day, year = format(Sys.Date(), "%Y"), convert = TRUE)
day |
the day of the puzzle |
year |
year of puzzle, defaults to current year |
convert |
logical: whether to run |
AOC author will also try to read options("usethis.full_name") for the author's name, if this environment variable is not set.
aoc_set_cookie(cookie) aoc_set_author(author)
aoc_set_cookie(cookie) aoc_set_author(author)
cookie |
a character string of the session cookie as found with network tools |
author |
Author name, for template |
sets environment variable and returns success message
sets environment variable and returns success message