Re: [R] Need help on matrix calculation

2013-04-29 Thread Jorge I Velez
Sorry, the first line should have been Mat[match( Subscript_Vec, rownames(Mat)),] and the rest remains the same. Best, Jorge.- On Mon, Apr 29, 2013 at 11:45 PM, Jorge I Velez wrote: > Christofer, > > The following should get you started: > > r <- Mat[match(rownames(Mat), Subscript_Vec),] > ro

Re: [R] Need help on matrix calculation

2013-04-29 Thread arun
11 A.K. - Original Message - From: Jorge I Velez To: Christofer Bogaso Cc: r-help Sent: Monday, April 29, 2013 9:45 AM Subject: Re: [R] Need help on matrix calculation Christofer, The following should get you started: r <- Mat[match(rownames(Mat), Subscript_Vec),] rownames(r) <- Subscrip

Re: [R] Need help on matrix calculation

2013-04-29 Thread Jorge I Velez
Christofer, The following should get you started: r <- Mat[match(rownames(Mat), Subscript_Vec),] rownames(r) <- Subscript_Vec r HTH, Jorge.- On Mon, Apr 29, 2013 at 11:38 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hello again, > > Let say I have 1 matrix: > > Mat <- matrix

[R] Need help on matrix calculation

2013-04-29 Thread Christofer Bogaso
Hello again, Let say I have 1 matrix: Mat <- matrix(1:12, 4, 3) rownames(Mat) <- letters[1:4] Now I want to subscript of Mat in following way: Subscript_Vec <- c("a", "e", "b", "c") However when I want to use this vector, I am geting following error: Mat[Subscript_Vec, ] Error: subscript out