From 434cbc5798680f127fbb191e6e91f046617a57bc Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 15 Jun 2024 06:59:18 +0200 Subject: [PATCH] Turn off `strings_as_factors_linter()` Since we rely on >= R 4.0 now. --- .lintr | 1 + R/token-define.R | 3 +-- R/ui-caching.R | 3 +-- R/utils.R | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.lintr b/.lintr index 9fd7b119c..726a8b596 100644 --- a/.lintr +++ b/.lintr @@ -14,6 +14,7 @@ linters: all_linters( todo_comment_linter = NULL, nonportable_path_linter = NULL, string_boundary_linter = NULL, + strings_as_factors_linter = NULL, # since we use R >= 4.0 undesirable_function_linter = NULL, undesirable_operator_linter = NULL ) diff --git a/R/token-define.R b/R/token-define.R index 0954bcb80..64813fa1d 100644 --- a/R/token-define.R +++ b/R/token-define.R @@ -23,8 +23,7 @@ token <- rbind.data.frame( c("if", "cond", "IF"), c("else", "cond", "ELSE"), c("in", "loop_cond", "IN"), - c("while", "loop_cond", "WHILE"), - stringsAsFactors = FALSE + c("while", "loop_cond", "WHILE") ) # styler: on diff --git a/R/ui-caching.R b/R/ui-caching.R index 1ab58e1c4..6713569e5 100644 --- a/R/ui-caching.R +++ b/R/ui-caching.R @@ -104,8 +104,7 @@ cache_info <- function(cache_name = NULL, format = "both") { last_modified = suppressWarnings(max(file_info$mtime)), created = file.info(path_cache)$ctime, location = path_cache, - activated = cache_is_activated(cache_name), - stringsAsFactors = FALSE + activated = cache_is_activated(cache_name) ) if (any(c("lucid", "both") == format)) { diff --git a/R/utils.R b/R/utils.R index 972e22286..4329915e0 100644 --- a/R/utils.R +++ b/R/utils.R @@ -44,7 +44,7 @@ re_match <- function(text, pattern) { end <- start + length - 1L matchstr <- substring(text, start, end) matchstr[start == -1L] <- NA_character_ - res <- data.frame(stringsAsFactors = FALSE, .text = text, .match = matchstr) + res <- data.frame(.text = text, .match = matchstr) gstart <- attr(match, "capture.start") glength <- attr(match, "capture.length") @@ -52,7 +52,7 @@ re_match <- function(text, pattern) { groupstr <- substring(text, gstart, gend) groupstr[gstart == -1L] <- NA_character_ dim(groupstr) <- dim(gstart) - res <- cbind(groupstr, res, stringsAsFactors = FALSE) + res <- cbind(groupstr, res) names(res) <- c(attr(match, "capture.names"), ".text", ".match") res