类似于head()的函数 [英] function similar to head() for matrix
本文介绍了类似于head()的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找可以打印matrix [1:5,1:5]的任何程序包中的函数. head()
对于那些只有几列但没有大矩阵的对象很有用.我知道我可以为此创建自己的函数,但是我想知道是否已经有一个函数.
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 create my own function for it but I am wondering if there is a function for it already.
推荐答案
在名为futile.matrix
的程序包中,有一个名为peek
的函数.
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)
从该功能的说明中:
"Peek是一个简单的实用程序,可以方便地查看 矩阵.这类似于头和尾,但是提供了二维 切片而不是完整的行."
"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."
这篇关于类似于head()的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文