https://github.com/koderkow/aocr
An R client for accessing Advent of Code’s data
https://github.com/koderkow/aocr
r rstats
Last synced: about 2 months ago
JSON representation
An R client for accessing Advent of Code’s data
- Host: GitHub
- URL: https://github.com/koderkow/aocr
- Owner: KoderKow
- License: other
- Created: 2022-12-07T07:34:53.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T15:06:10.000Z (over 3 years ago)
- Last Synced: 2025-12-30T21:23:13.852Z (6 months ago)
- Topics: r, rstats
- Language: R
- Homepage: https://koderkow.github.io/aocr/
- Size: 63.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
cache = TRUE
)
```
# aocr
> 💻 An R client for accessing [Advent of Code](https://adventofcode.com/)'s data
- This package will only help obtain data, it will not assist in posting solutions via HTTP request
- All requests are cached to reduce the number of interactions with Advent of Code's website
[](https://github.com/KoderKow/aocr/actions/workflows/R-CMD-check.yaml)
## Installation
You can install the dev version of **{aocr}** from [GitHub](https://github.com/koderkow/aocr) with:
```{r, eval = FALSE}
devtools::install_packages("koderkow/aocr")
```
# Load the package
```{r pkg load}
library(aocr)
```
# Session ID
A session ID is needed to get a proper response from the Advent of Code's website. To obtain and set this as an environment variable run `aoc_set_session_id()`.
# Obtaining data
## Tibble
There are currently two function for obtaining data for the Advent of Code challenges:
```{r read data as tibble}
d_init <- aoc_get_data_as_tibble(2022, 1)
head(d_init)
```
## Raw response
If `aoc_get_data_as_tibble()` doesn't get the data in the right format, working with the response will be needed. [{httr2}](https://httr2.r-lib.org/) is the engine for making HTTP requests. Familiarity with that package will be needed to clean/parse the response.
```{r read data as resp}
resp <- aoc_get_response(2022, 1)
resp
```
# View the puzzle
If you need to view the puzzle's information to review or submit a solution it can be quickly pulled up via web browser:
```{r view puzzle, eval=FALSE}
aoc_view_puzzle(2022, 1)
```