I have a simple question here actually, I have a matrix (file1) of data (say 20 columns by 100 rows). which looks like this
A B C D E F ...
5 6 2 3 4 5 ...
5 6 2 3 4 5 ...
5 6 2 3 4 5 ...
5 6 2 3 4 5 ...
5 6 2 3 4 5 ...
. . . . . .
. . . . . .
. . . . . .
I have a variable named “R” which is
R <- c(A,C,E,F)
I want to make a new matrix (file2) which contains only columns that match the variable “R”
It should be a simple command I think, but I just couldn’t find the right way to write this.
Please note that the A B C D E F are colnames, not a first row.
cheers,
What about this?