作者:蜗牛闯红灯 | 来源:互联网 | 2023-09-12 09:14
IhaveatablethatImreadingintoR(asadata.frame),andthenselectingsomenumericcolumnsou
I have a table that I'm reading into R (as a data.frame), and then selecting some numeric columns out of that data.frame to make into a matrix. I would expect to get a 2D matrix from this, however this is what I get:
我有一个表,我正在读R(作为data.frame),然后从该data.frame中选择一些数字列,使其成为一个矩阵。我期望得到一个2D矩阵,但这是我得到的:
full = read.table('complete_dataset.txt', header=T, sep="\t", quote="",row.names=NULL, stringsAsFactors=FALSE)
> matrix(full[ ,4:11])
[,1]
[1,] Numeric,6152
[2,] Numeric,6152
[3,] Numeric,6152
[4,] Numeric,6152
[5,] Numeric,6152
[6,] Numeric,6152
[7,] Numeric,6152
[8,] Numeric,6152
> dim(matrix(full[ ,4:11]))
[1] 8 1
any suggestions?
1 个解决方案