R: Efficiently remove singleton dimensions from array

后端 未结 1 852
野趣味
野趣味 2021-01-17 20:47

I am looking for a fast way to remove redundant dimensions from an array in R, similar to the squeeze() command in MATLAB. Right now I combine the melt()<

1条回答
  •  醉话见心
    2021-01-17 21:36

    It sounds like you're looking for drop(), which "delete[s] the dimensions of an array which have only one level".

    drop(array3d)
    #       [,1] [,2]
    # [1,]    0    0
    # [2,]    0    0
    

    0 讨论(0)
提交回复
热议问题