I am very new at R and am struggling to create a matrix. My eventual goal is to produce a variance covariance matrix comparing 6 numeric variables (columns) by groups. I have 2187 rows of data, which are divided among to several hundred groups. I tried to create a matrix with variations of the following, using the help(matrix) information. This gives me a matrix that is the correct size, but filled with x,y information based on the structure of the database:
matrix(data = PhenoM, nrow = 2187, ncol = 6, byrow = FALSE, dimnames = NULL)
[,1] [,2] [,3] [,4] [,5] [,6]
[,1] factor,2187 Integer,2187 Integer,2187 Numeric,2187 Numeric,2187 .factor,2187
[,2] factor,2187 Numeric,2187 Numeric,2187 Numeric,2187 factor,2187 Integer,2187
[,3] factor,2187 Numeric,2187 Numeric,2187 Numeric,2187 factor,2187 Numeric,2187
I'm also not sure how to instruct R that the 6 columns of information I want in the matrix are the last 6 of 13 (read right to left). Thank you for your help!