richard_raubertas@merck.com
2003-Sep-09 16:53 UTC
[Rd] Problem with 'drop' for 1-D arrays? (PR#4110)
R 1.7.1 on Windows XP The argument 'drop' appears to be ignored when subscripting 1-dimensional arrays (i.e., arrays whose 'dim' attribute has length 1):> x <- array(1:5, dim=c(5)) > dim(x)[1] 5> dim(x[, drop=TRUE]) # Shouldn't this be NULL?[1] 5> dim(x[2:3]) # This seems right: default is drop=TRUENULL> dim(x[2:3, drop=FALSE]) # But this seems wrongNULL Note that the behavior with a 2-D array is different:> y <- array(1:5, dim=c(1,5)) > dim(y)[1] 1 5> dim(y[,,drop=TRUE])NULL> dim(y[,2:3])NULL> dim(y[,2:3,drop=FALSE])[1] 1 2 Rich Raubertas Biometrics Research, RY33-300 Merck & Co. ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}