function similar to head() for matrix

后端 未结 1 329
攒了一身酷
攒了一身酷 2021-01-21 11:51

I am looking for a function in any package that can print matrix[1:5, 1:5]. head() is good for those that have few columns but not for a large matrix. I know I can

相关标签:
1条回答
  • 2021-01-21 12:49

    There is a function called peek in a package called futile.matrix.

    library(futile.matrix)
    m <- matrix(c(1,3,4,2, 5,10,11,2, 3,42,8,22, 23,15,3,8), ncol = 4)
    peek(m, 4)
    

    From the description of that function:

    "Peek is a simple utility to conveniently look at a portion of a matrix. This is similar to head and tail but provides a 2-dimensional slice instead of a complete row."

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