Skip to content

Commit

Permalink
v1.7.1 Quickfix: isTRUE is R >= 3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gagolews committed Jul 14, 2021
1 parent 7e4cb0c commit 42353fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion R/encoding_management.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#' @export
stri_enc_list <- function(simplify=TRUE)
{
simplify <- isTRUE(simplify)
simplify <- (is.logical(simplify) && length(simplify) == 1L && !is.na(simplify) && simplify) # isTRUE(simplify)

ret <- .Call(C_stri_enc_list)
if (simplify) {
Expand Down
10 changes: 6 additions & 4 deletions R/sub.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,17 @@ stri_sub <- function(
str, from = 1L, to = -1L, length,
use_matrix=TRUE, ignore_negative_length=FALSE
) {
use_matrix <- (is.logical(use_matrix) && base::length(use_matrix) == 1L && !is.na(use_matrix) && use_matrix) # isTRUE(use_matrix)
if (missing(length)) {
if (isTRUE(use_matrix) && is.matrix(from) && !missing(to)) {
if (use_matrix && is.matrix(from) && !missing(to)) {
warning("argument `to` is ignored in the current context")
to <- NULL
}
.Call(C_stri_sub, str, from, to, NULL, use_matrix, ignore_negative_length)
} else {
if (!missing(to))
warning("argument `to` is ignored in the current context")
if (isTRUE(use_matrix) && is.matrix(from)) {
if (use_matrix && is.matrix(from)) {
warning("argument `length` is ignored in the current context")
length <- NULL
}
Expand All @@ -173,16 +174,17 @@ stri_sub <- function(
`stri_sub<-` <- function(
str, from = 1L, to = -1L, length, omit_na=FALSE, use_matrix=TRUE, value
) {
use_matrix <- (is.logical(use_matrix) && base::length(use_matrix) == 1L && !is.na(use_matrix) && use_matrix) # isTRUE(use_matrix)
if (missing(length)) {
if (isTRUE(use_matrix) && is.matrix(from) && !missing(to)) {
if (use_matrix && is.matrix(from) && !missing(to)) {
warning("argument `to` is ignored in this context")
to <- NULL
}
.Call(C_stri_sub_replacement, str, from, to, NULL, omit_na, value, use_matrix)
} else {
if (!missing(to))
warning("argument `to` is ignored in this context")
if (isTRUE(use_matrix) && is.matrix(from)) {
if (use_matrix && is.matrix(from)) {
warning("argument `length` is ignored in this context")
length <- NULL
}
Expand Down
3 changes: 2 additions & 1 deletion R/time_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ stri_datetime_fstr <- function(x, ignore_special=TRUE)
{
x <- .Call(C_stri_datetime_fstr, x)

if (length(x) > 0 && isFALSE(ignore_special)) {
ignore_special <- (is.logical(ignore_special) && length(ignore_special) == 1L && !is.na(ignore_special) && ignore_special) # isTRUE(ignore_special)
if (length(x) > 0 && !ignore_special) {
formats <- outer(
c("date", "time", "datetime", "date_relative", "datetime_relative"),
c("full", "long", "medium", "short"),
Expand Down

0 comments on commit 42353fb

Please sign in to comment.