这个R代码是什么意思?
How does this code of R means?
第一行导入数据文件,第二行假设创建一个包含 100 个数据的子集
i) 将数据分配给矩阵,
例如使用
the.data <- as.matrix(read.table("filename.txt"))
(ii) 您感兴趣的变量是 Y-Rank ID.Generate 100 个数据的子集,例如使用:
**my.data <- the.data[sample(1:161,100), c(1,3:10,12,13)]**
第二行代码是什么意思???谢谢
在下面的代码行中:
my.data <- the.data[sample(1:161,100), c(1,3:10,12,13)]
my.data
中的第一个索引对应于所需的行,第二个索引对应于所需的列。
sample(1:161,100) <-- take 100 random rows from 1 to 161
c(1,3:10,12,13) <-- take columns 1, 3 to 10, 12, and 13
第一行导入数据文件,第二行假设创建一个包含 100 个数据的子集
i) 将数据分配给矩阵, 例如使用
the.data <- as.matrix(read.table("filename.txt"))
(ii) 您感兴趣的变量是 Y-Rank ID.Generate 100 个数据的子集,例如使用:
**my.data <- the.data[sample(1:161,100), c(1,3:10,12,13)]**
第二行代码是什么意思???谢谢
在下面的代码行中:
my.data <- the.data[sample(1:161,100), c(1,3:10,12,13)]
my.data
中的第一个索引对应于所需的行,第二个索引对应于所需的列。
sample(1:161,100) <-- take 100 random rows from 1 to 161
c(1,3:10,12,13) <-- take columns 1, 3 to 10, 12, and 13