The first line import the data file and the second one suppose to create a subset of 100 data
i) Assign the data to a matrix, e.g. using
the.data <- as.matrix(read.table("filename.txt"))
(ii) Your variable of interest is Y-Rank ID.Generate a subset of 100 data, e.g. using:
**my.data <- the.data[sample(1:161,100), c(1,3:10,12,13)]**
What does second line of code means??? thanks
In the following line of code:
my.data <- the.data[sample(1:161,100), c(1,3:10,12,13)]
The first index into my.data
corresponds to the desired rows, and the second index corresponds to the desired columns.
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