请问一下,R语言scan函数读取制表分隔符txt中的数据时,怎么才能生成矩阵啊?我这样读出来是个向量。但是书上说scan函数的读取结果应该是矩阵啊。

Seacreature2=scan(file = "E:\Homework of R languange\data and solutions\BookData\ISIT.txt",skip=1,dec=".")
结果:
num[1:3495] 517 28.7 1 ....

用scan读取数据成矩阵,可用语句:Seacreature2 <- matrix(scan("E:\Homework of R languange\data and solutions\BookData\ISIT.txt", what="c", dec='
.', skip=1),ncol=4, byrow=TRUE) 。ncol改成实际列数
参考: