Skip to contents

Read in the puzzle input, or other file, as a vector, one element per line. It assumes that the file is stored in the directory "./YYYY/day/DD", where YYYY and DD are the values of year and day. By default, the file name is "input". This file will exist in this location if the post was created using aoc_new_day(). The reading is done by readLines().

Usage

aoc_input_vector(
  day,
  year = NULL,
  file = "input",
  mode = c("character", "numeric")
)

Arguments

day

An integer between 1 and 25

year

An integer representing the year, from 2015 to the current year. Defaults to the current year.

file

Character string. The name of a file that exists in the directory "./YYYY/day/DD", where YYYY and DD are the values of year and day. Defaults to "input".

mode

Character string. One of 'character' or 'numeric'. Default is 'character'.

Value

A vector containing the puzzle input for the day and year.

Examples

if (FALSE) aoc_input_vector(1, 2020, "numeric")