Hi, I want to prohibit the automatic collapsing of degenerate array indices:> str( array(1,dim=c(3,4,5,1,1)) )num [1:3, 1:4, 1:5, 1, 1] 1 1 1 1 1 1 1 1 1 1 ...> str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,] )num [1:2, 1:3, 1:2] 1 1 1 1 1 1 1 1 1 1 ... The last command removed the degenerate indices. I don't want that. What can I do? Thanks Sebastian -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120419/fb3a99e2/attachment.bin>
On 19/04/2012 9:14 AM, Sebastian Schubert wrote:> Hi, > > I want to prohibit the automatic collapsing of degenerate array indices: > > > str( array(1,dim=c(3,4,5,1,1)) ) > num [1:3, 1:4, 1:5, 1, 1] 1 1 1 1 1 1 1 1 1 1 ... > > str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,] ) > num [1:2, 1:3, 1:2] 1 1 1 1 1 1 1 1 1 1 ... > > The last command removed the degenerate indices. I don't want that. What > can I do?Use "drop=FALSE". See ?"[". Duncan Murdoch
On Apr 19, 2012, at 9:14 AM, Sebastian Schubert wrote: Compare>> str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,]> str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,,drop=FALSE] ) num [1:2, 1:3, 1:2, 1, 1] 1 1 1 1 1 1 1 1 1 1 ... -- David Winsemius, MD West Hartford, CT