Re: [R] basic subset question of matrix

2012-03-31 Thread jim holtman
I think you want: index <- row.names(myMatrix) %in% list_to_keep[,1] This will give a boolean expression as long as the number of rows in myMatrix; your original only had a list as long as list_to_keep On Sat, Mar 31, 2012 at 12:26 PM, Peter Davidsen wrote: > Dear list, > > I would like to sub

[R] basic subset question of matrix

2012-03-31 Thread Peter Davidsen
Dear list, I would like to subset a large expression matrix based on rownames. That is, I have a list (as a txt-file) with gene names that matches some of the rows in my matrix. I've loaded my matrix as well as gene list using the read.table() command. myMatrix <- read.table("name_of_file.txt",