Skip to content

Commit

Permalink
CRAN 5.1.4 [fix broken link]
Browse files Browse the repository at this point in the history
  • Loading branch information
laresbernardo committed Sep 8, 2022
1 parent 3d75b74 commit 2fe0fe4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: lares
Type: Package
Title: Analytics & Machine Learning Sidekick
Version: 5.1.3
Version: 5.1.4
Authors@R: c(
person("Bernardo", "Lares", , "laresbernardo@gmail.com", c("aut", "cre")))
Maintainer: Bernardo Lares <laresbernardo@gmail.com>
Expand Down
11 changes: 8 additions & 3 deletions R/other_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ NULL
#' @param stop Boolean. Stop if not installed. If \code{FALSE} and
#' library is not available, warning will be shown.
#' @param load Boolean. Load library?
#' @param ... Enabled lazyeval to ignore shared parameters.
#' @param lib.loc Character vector. Location of R library trees
#' to search through, or \code{NULL}. The default value of \code{NULL}
#' corresponds to all libraries currently known to \code{.libPaths()}.
#' Non-existent library trees are silently ignored.
#' @param ... Pass additional parameters.
#' @return No return value, called for side effects.
#' @examples
#' # Check if library base is installed. If not, stop and show error
#' try_require("base", stop = TRUE)
#' # Check if library xxx is installed. If not, show warning
#' try_require("xxx", stop = FALSE)
#' @export
try_require <- function(package, stop = TRUE, load = TRUE, ...) {
try_require <- function(package, stop = TRUE, load = TRUE, lib.loc = NULL, ...) {
present <- length(find.package(package, quiet = TRUE)) > 0
if (present & load) {
suppressPackageStartupMessages(library(package, character.only = TRUE))
# Be careful: ... parameter is not enabled in library()
suppressPackageStartupMessages(library(package, character.only = TRUE, lib.loc = lib.loc))
} else {
if (stop) {
stop(paste0("Package '", package, "' required. Install and try again."), call. = FALSE)
Expand Down
8 changes: 3 additions & 5 deletions R/wordle.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @param lang_dic Character. Any of: "en", "es". Only used when \code{dictionary}
#' parameter is NULL. Requires internet connection the first time. Uses cache.
#' @param method Integer. 1 for \code{scrabble_dictionary()}, 3 for scrapping
#' \href{https://www.nytimes.com/games/wordle/index.html}{NYTimes} set of words.
#' the words taken straight from the game's source code.
#' @param print Boolean. Print validation results?
#' @return Invisible vector with results by letter.
#' @examples
Expand Down Expand Up @@ -92,10 +92,8 @@ wordle_dictionary <- function(lang_dic = "en", method = 3, quiet = TRUE) {
words <- scrabble_dictionary(lang_dic, quiet)[[1]]
}
if (method == 3) {
url <- "https://www.nytimes.com/games/wordle/main.bd4cb59c.js"
temp <- str_split(readLines(url), '"')[[1]]
words <- toupper(unique(temp[nchar(temp) == 5]))
words <- grep("^[[:alnum:]]+$", words, value = TRUE)
url <- "https://raw.githubusercontent.com/tabatkins/wordle-list/main/words"
words <- readLines(url, warn = FALSE)
}
out <- toupper(words[nchar(words) == 5])
cache_write(out, cache_name, quiet = quiet)
Expand Down
9 changes: 7 additions & 2 deletions man/try_require.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/wordle.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2fe0fe4

Please sign in to comment.