input_file: Generate path to puzzle input file

Description Usage Arguments Details Value

View source: R/utils.R

Description

Puzzle inputs are typically saved in the form of text files with the name input01.txt, input02.txt, ... etc. in the package's inst/ folder. This helper function makes it easy to read in the data using the readLines, scan or read.csv functions, as appropriate.

Usage

1

Arguments

day

integer between 1 and 25

Details

Sometimes inputs are simple strings or numbers and passed directly to the function, rather than being read from file. So not every day will have an input.txt file associated with it.

Value

File path, e.g. "path/to/input01.txt". If that file does not exist, or if the argument day is not between 1 and 25, an error will be thrown.


Selbosh/adventofcode2021 documentation built on Jan. 1, 2022, 7:20 p.m.