我想显示一个没有小的 [1,] 和 [,1] 行和列指示符的矩阵列表(不是单个矩阵,正如其他地方所询问的那样)。
例如,给定myList
:
myList <- list(matrix(c(1,2,3,4,5,6), nrow = 2), matrix(c(1,2,3,4,5,6), nrow = 3))
names(myList) <- c("This is the first matrix:", "This is the second matrix:")
我正在寻找一些myFunction()
将输出的功能:
> myFunction(myList)
$`This is the first matrix:`
1 3 5
2 4 6
$`This is the second matrix:`
1 4
2 5
3 6
如果它可以消除...
列表名称周围的 $ 以便显示:
This is the first matrix:
1 3 5
2 4 6
This is the second matrix:
1 4
2 5
3 6
阅读所有相关问题后,我尝试过
myList %>% lapply(print, row.names = F)
myList %>% lapply(prmatrix, collab = NULL, rowlab = NULL)
myList %>% lapply(write.table, sep = " ", row.names = F, col.names = F)
但没有一个按预期工作。