diff --git a/.github/workflows/dataset-check.yaml b/.github/workflows/dataset-check.yaml index 48fd459..2773e94 100644 --- a/.github/workflows/dataset-check.yaml +++ b/.github/workflows/dataset-check.yaml @@ -3,10 +3,12 @@ on: paths: - 'data-raw/generate_data.R' - 'data-raw/corpus/*' + - 'CHANGELOG.qmd' pull_request: paths: - 'data-raw/generate_data.R' - 'data-raw/corpus/*' + - 'CHANGELOG.qmd' name: dataset-check @@ -37,15 +39,29 @@ jobs: any::usethis any::dplyr any::readr + any::tibble any::roxygen2 + any::lubridate extra-packages: local::. - - name: Run Rscript + - name: Generate datasets and docs run: Rscript 'data-raw/generate_data.R' + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + version: 1.6.1 + + - name: Render CHANGELOG + uses: quarto-dev/quarto-actions/render@v2 + with: + path: CHANGELOG.qmd + - name: Update pull request uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Regenerate datasets and/or dataset documentation - file_pattern: 'R/data.R data/*.rda' + file_pattern: 'R/data.R data/*.rda CHANGELOG.md' diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9325e3b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,74 @@ +# {lovecraftr} Changelog + + + + +| Dataset | Raw Last Updated | Dataset Last Updated | +|:-------------------------------------------------------|:--------------------|:---------------------| +| AT THE MOUNTAINS OF MADNESS | 2024-07-04 20:27:18 | 2024-07-04 20:27:18 | +| AZATHOTH | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| BEYOND THE WALL OF SLEEP | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| CELEPHAIS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| COOL AIR | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| DAGON | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| DREAMS IN THE WITCH-HOUSE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| EX OBLIVIONE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| FACTS CONCERNING THE LATE ARTHUR JERMYN AND HIS FAMILY | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| FROM BEYOND | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| HE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| HERBERT WEST: REANIMATOR | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| HYPNOS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| IMPRISONED WITH THE PHARAOHS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| IN THE VAULT | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| MEDUSA’S COIL | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| MEMORY | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| NYARLATHOTEP | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| PICKMAN’S MODEL | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| POETRY OF THE GODS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| POLARIS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE ALCHEMIST | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE BEAST IN THE CAVE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE BOOK | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE CALL OF CTHULHU | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE CASE OF CHARLES DEXTER WARD | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE CATS OF ULTHAR | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE COLOUR OUT OF SPACE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE CRAWLING CHAOS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE DESCENDANT | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE DOOM THAT CAME TO SARNATH | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE DREAM QUEST OF UNKNOWN KADATH | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE DUNWICH HORROR | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE EVIL CLERGYMAN | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE FESTIVAL | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE HAUNTER OF THE DARK | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE HORROR AT MARTIN’S BEACH | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE HORROR AT RED HOOK | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE HOUND | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE LURKING FEAR | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE MOON BOG | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE MUSIC OF ERICH ZANN | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE NAMELESS CITY | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE OTHER GODS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE OUTSIDER | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE PICTURE IN THE HOUSE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE QUEST OF IRANON | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE RATS IN THE WALLS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE SHADOW OUT OF TIME | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE SHADOW OVER INNSMOUTH | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE SHUNNED HOUSE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE SILVER KEY | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE STATEMENT OF RANDOLPH CARTER | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE STRANGE HIGH HOUSE IN THE MIST | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE STREET | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE TEMPLE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE TERRIBLE OLD MAN | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE THING ON THE DOORSTEP | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE TOMB | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE TRANSITION OF JUAN ROMERO | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE TREE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE UNNAMABLE | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE VERY OLD FOLK | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE WHISPERER IN DARKNESS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THE WHITE SHIP | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| THROUGH THE GATES OF THE SILVER KEY | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | +| WHAT THE MOON BRINGS | 2024-06-30 15:25:18 | 2024-07-04 20:27:18 | diff --git a/CHANGELOG.qmd b/CHANGELOG.qmd new file mode 100644 index 0000000..ee036bc --- /dev/null +++ b/CHANGELOG.qmd @@ -0,0 +1,34 @@ +--- +title: "{lovecraftr} Changelog" +format: gfm +--- + + +```{R setup, output=FALSE, echo=FALSE, eval=TRUE} +library(dplyr) +library(tibble) +library(readr) +library(fs) +library(lubridate) + +raw_files <- list.files(file.path("data-raw", "corpus"), full.names = TRUE) +titles <- read_lines(raw_files, n_max = 1) +datasets <- list.files("data", full.names = TRUE) +path_to_remove <- "data/lovecraft.rda" +datasets <- setdiff(datasets, path_to_remove) +raw_file_info <- file_info(raw_files)["modification_time"] +dataset_file_info <- file_info(datasets)["modification_time"] +raw_file_info$modification_time <- as_datetime(raw_file_info$modification_time) +dataset_file_info$modification_time <- as_datetime(dataset_file_info$modification_time) + +changelog <- tibble( + Dataset = titles, + "Raw Last Updated" = raw_file_info$modification_time, + "Dataset Last Updated" = dataset_file_info$modification_time +) +``` + +```{R changelog, output=TRUE, echo=FALSE, eval=TRUE} +changelog %>% + knitr::kable() +``` diff --git a/README.qmd b/README.qmd index d814502..c7e362c 100644 --- a/README.qmd +++ b/README.qmd @@ -28,6 +28,19 @@ knitr::opts_chunk$set( This package contains H. P. Lovecraft's corpus as R datasets for textual analysis. +## Installation + +Install from [GitHub](https://github.com/jrdnbradford/lovecraftr/) using {[devtools](https://devtools.r-lib.org/)}: +```{R devtools-install, echo=TRUE, eval=TRUE} +# install.packages("devtools") +devtools::install_github("jrdnbradford/lovecraftr") +``` +or {[remotes](https://remotes.r-lib.org//)}: +```{R remotes-install, echo=TRUE, eval=FALSE} +# install.packages("remotes") +remotes::install_github("jrdnbradford/lovecraftr") +``` + ## Usage Character vectors of individual works can be accessed in several ways: @@ -45,7 +58,7 @@ The entire corpus can be accessed as a tibble with: corpus <- lovecraftr::lovecraft_corpus() corpus |> - dplyr::filter(title == "The Call Of Cthulhu") |> + dplyr::filter(title == "THE CALL OF CTHULHU") |> head() ``` or @@ -53,19 +66,10 @@ or data("lovecraft") ``` -## Installation - -Install from [GitHub](https://github.com/jrdnbradford/lovecraftr/) using {[devtools](https://devtools.r-lib.org/)}: -```{R devtools-install, echo=TRUE, eval=FALSE} -# install.packages("devtools") -devtools::install_github("jrdnbradford/lovecraftr") -``` -or {[remotes](https://remotes.r-lib.org//)}: -```{R remotes-install, echo=TRUE, eval=FALSE} -# install.packages("remotes") -remotes::install_github("jrdnbradford/lovecraftr") -``` - ## Contributing See [CONTRIBUTING.md](/.github/CONTRIBUTING.md). + +## Changelog + +See [CHANGELOG.md](/CHANGELOG.md) diff --git a/data-raw/generate_data.R b/data-raw/generate_data.R index 29707c8..895f9b8 100644 --- a/data-raw/generate_data.R +++ b/data-raw/generate_data.R @@ -42,9 +42,7 @@ for (txt in corpus) { assign(txt, text) do.call(usethis::use_data, list(dataset_name, overwrite = TRUE)) - title <- text |> - head(1) |> - stringr::str_to_title() + title <- text |> head(1) dataset_docs <- glue::glue(docs_template) docs <- c(docs, dataset_docs)