Skip to content

Instantly share code, notes, and snippets.

@lindeloev
lindeloev / mutate_progress.R
Last active September 15, 2022 07:23
mutate_progress()
#' dplyr::mutate, but with a progress bar for grouped data
#'
#' @aliases mutate_progress
#' @export
#' @inheritParams dplyr::mutate
#' @param .prefix Text to show before the progress bar.
#' @param .format Format for the progress bar. See documentation in \code{\link[progress]{progress_bar}}.
#' - ":what" identifies the current group.
#' - ":total" is the total number of groups.
#' - ":current" is the current group number.
@lindeloev
lindeloev / wordle_solver.R
Last active January 18, 2022 18:26
Optimal guesses for Wordle
# Use these functions to make smart guesses for Wordle (https://www.powerlanguage.co.uk/wordle/)
# find_word() returns words that satisfies the wordle feedback. Start with `possible_words`, i.e., all 5-letter english words.
# next_word() returns words that are most likely to result in green letters.
#
# A pretty good strategy on the next_word() output is to use "pathfinder" for the first two words and "guess" thereafter, picking the first commonly-known word.
#############
# FUNCTIONS #
#############