HenrikBengtsson / listenv

R package: listenv - Environments Behaving As Lists
https://listenv.futureverse.org
30 stars 2 forks source link

parse_env_subset(): Error in subset_kk >= 1 && subset_kk <= dim[kk] : 'length(x) = 2 > 1' in coercion to 'logical(1)' #40

Closed HenrikBengtsson closed 5 years ago

HenrikBengtsson commented 5 years ago
Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_"="true")

x <- listenv()
dim(x) <- c(1, 2)

target <- parse_env_subset(x[1,1:2])
## Error in subset_kk >= 1 && subset_kk <= dim[kk] : 
##   'length(x) = 2 > 1' in coercion to 'logical(1)'
HenrikBengtsson commented 5 years ago

Another example, that hits another piece of code, is:

library(listenv)
z <- as.listenv(1:2); names(z) <- c("a", "b")

target <- parse_env_subset(z[c("a", "b")])
## Error in !is.na(res$idx) && !is.na(map[res$idx]) : 
##  'length(x) = 2 > 1' in coercion to 'logical(1)'

but this works:

target <- parse_env_subset(z[1:2])