Created
September 21, 2023 08:08
-
-
Save matt-dray/d22163d5effc61e2a88085c185212db6 to your computer and use it in GitHub Desktop.
Freeing Brian Bilston's spreadsheet-based 'Cells' poem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Freeing Brian Bilston's spreadsheet-based 'Cells' poem | |
# https://x.com/brian_bilston/status/1704061266979959099?s=46&t=QpOVBfS2sVIbcjn3ZLif3g | |
# Assuming the poem is saved to the file cells.xlsx | |
cells <- tidyxl::xlsx_cells("cells.xlsx", include_blank_cells = FALSE) | |
txt <- cells$character | |
txt_len <- length(txt) | |
author <- paste0("-", txt[txt_len]) | |
txt <- txt[-txt_len] | |
lines <- split(txt, ceiling(seq_along(txt) / max(cells$col))) |> append(author) | |
lapply(lines, \(x) paste(x, collapse = " ")) |> unlist() |> cat(sep = "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment