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

Re: [R] Extracting selected rows from a matrix

2010-11-29 Thread Kjetil Halvorsen
see below. On Mon, Nov 29, 2010 at 5:56 PM, pankaj borah wrote: > Hi, > > I have matrix of 104 columns and 3 rows (Each Row has rowname). > > I have 13 different  list of selected rownames (character) say 1000 each. Now > I want to extract the all the columns according to the rownames in eac

[R] Extracting selected rows from a matrix

2010-11-29 Thread pankaj borah
Hi, I have matrix of 104 columns and 3 rows (Each Row has rowname). I have 13 different  list of selected rownames (character) say 1000 each. Now I want to extract the all the columns according to the rownames in each the list. How can I do that in R ? 1 ) For a single list 2) For all