Assuming that your data is in a dataframe 'cordata' , then following should work:
cordata$cor2_value <- sapply(1:nrow(cordata), function(.row){ cor2[cordata$rowname[.row], cordata$colname[.row]] } On Mon, Nov 16, 2009 at 11:44 AM, Lee William <leeon...@gmail.com> wrote: > Hi! All, > > I have 2 correlation matrices of 4000x4000 both with same row names and > column names say cor1 and cor2. I have extracted some information from 1st > matrix cor1 which is something like this: > > rowname colname cor1_value > a b 0.8 > b a 0.8 > c f 0.62 > d k 0.59 > - - -- > - - -- > > Now I wish to extract values from matrix cor2 for the same rowname and > colname as above so that it looks similar to something like this with values > in cor2_value: > > rowname colname cor1_value cor2_value > a b 0.8 --- > b a 0.8 --- > c f 0.62 --- > d k 0.59 --- > - - -- --- > - - -- --- > > I am running out of ideas. So I decided to post this on mailing list. Please > Help! > > Best > Lee > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.