Re: [R] Extracting selected rows from a matrix to a submatix

2011-04-14 Thread Dennis Murphy
Hi: Here's an example: m <- as.data.frame(matrix(rnorm(1), nrow = 100)) dim(m) [1] 100 100 # Assign rownames to rows of m rownames(m) <- paste('A', 1:100, sep = '') # Select a random subset of the rownames vn <- sample(rownames(m), 50) # Subset m by selecting the rownames from vn m2 <- m[ro

[R] Extracting selected rows from a matrix to a submatix

2011-04-13 Thread pankaj borah
I have a matrix M > dim(M) [1] 30380   561 I have another list L contains , that contains some row names of matrix M str (L)  chr [1:21037] Now I want to extract the submatrix subM (21037    ,    561)  from the matrix M by matching the rownames (M) to the 21037 rownames o f L How do I do that