R Under development (unstable) (2024-09-10 r87115 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(abind) > x <- array(1:24,dim=c(2,3,4),dimnames=list(letters[1:2],LETTERS[1:3],letters[23:26])) > adrop(x[1,,,drop=FALSE],drop=1) w x y z A 1 7 13 19 B 3 9 15 21 C 5 11 17 23 > adrop(x[,1,,drop=FALSE],drop=2) w x y z a 1 7 13 19 b 2 8 14 20 > adrop(x[,,1,drop=FALSE],drop=3) A B C a 1 3 5 b 2 4 6 > adrop(x[1,1,1,drop=FALSE],drop=1) w A 1 > adrop(x[1,1,1,drop=FALSE],drop=2) w a 1 > adrop(x[1,1,1,drop=FALSE],drop=3) A a 1 > adrop(x[1,1,1,drop=FALSE],drop=1:2) w 1 > adrop(x[1,1,1,drop=FALSE],drop=1:2,one.d=TRUE) w 1 > adrop(x[1,1,1,drop=FALSE],drop=1:2,named=FALSE) [1] 1 > dim(adrop(x[1,1,1,drop=FALSE],drop=1:2,one.d=TRUE)) [1] 1 > dimnames(adrop(x[1,1,1,drop=FALSE],drop=1:2,one.d=TRUE)) [[1]] [1] "w" > names(adrop(x[1,1,1,drop=FALSE],drop=1:2,one.d=TRUE)) [1] "w" > dim(adrop(x[1,1,1,drop=FALSE],drop=1:2)) NULL > dimnames(adrop(x[1,1,1,drop=FALSE],drop=1:2)) NULL > names(adrop(x[1,1,1,drop=FALSE],drop=1:2)) [1] "w" > x <- array(1:3, dimnames=list(letters[1:3])) > x a b c 1 2 3 > options(error=function() NULL) > adrop(x) Error in adrop.default(x) : dimensions to drop (1) do not have length 1 Calls: adrop -> adrop.default > dim(adrop(x)) Error in adrop.default(x) : dimensions to drop (1) do not have length 1 Calls: adrop -> adrop.default > adrop(x, NULL) a b c 1 2 3 > dim(adrop(x, NULL)) NULL > > proc.time() user system elapsed 0.07 0.09 0.15