Passing a vector of two or more dimensions results in an error. I believe this is due to an update in base R detailed here:
"Calling && or || with LHS or (if evaluated) RHS of length greater than one is now always an error, with a report of the form length = 4' in coercion to 'logical(1)"
Although the R release notes say this change is currently only in R-devel, i'm getting the issue with R4.2.0
Steps to reproduce the problem
dimensions <- c("date", "query")
if(!is.null(dimensions) && !dimensions %in% c('date','country', 'device', 'page', 'query','searchAppearance')){
stop("dimension must be NULL or one or more of 'date','country', 'device', 'page', 'query', 'searchAppearance'.
Got this: ", paste(dimensions, sep=", "))
}
Expected output
No error
Actual output
Error msg: 'length(x) = 2 > 1' in coercion to 'logical(1)'
Session Info
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
What goes wrong
Passing a vector of two or more dimensions results in an error. I believe this is due to an update in base R detailed here:
"Calling && or || with LHS or (if evaluated) RHS of length greater than one is now always an error, with a report of the form
length = 4' in coercion to 'logical(1)
"Although the R release notes say this change is currently only in R-devel, i'm getting the issue with R4.2.0
Steps to reproduce the problem
Expected output
No error
Actual output
Error msg: 'length(x) = 2 > 1' in coercion to 'logical(1)'
Session Info
R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale: [1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8 LC_MONETARY=English_United Kingdom.utf8 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.utf8
attached base packages: [1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached): [1] compiler_4.2.0 tools_4.2.0