[R] Grabbing Column and Row titles
chuck.01
CharlieTheBrown77 at gmail.com
Fri Jan 27 15:55:49 CET 2012
Please use dput() to post your example matrix.
Rambler1 wrote
>
> I have run into a problem in my code. What I want to accomplish is this:
> I have a user input stock symbols into a list and from there I run the
> quantmod package to get historical data. I compute the correlation matrix
> and then turn that matrix into a simple matrix with 1's or 0's depending
> on how strong the correlation is. From here I would like to go into the
> matrix and take all the 1's and match them with their row/column titles.
> So for each 1 I have two stock symblos. For example:
> MMM ACE ABT ANF HD PEP K GOOG BIDU JNJ
> MMM 0 1 0 0 0 1 0 0 0
> 0
> ACE 1 0 0 0 0 0 0 0
> 0 1
> ABT 0 0 0 0 0 1 0 0
> 0 1
> ANF 0 0 0 0 0 0 0 0
> 0 0
> HD 0 0 0 0 0 0 0 0
> 0 0
> PEP 1 0 1 0 0 0 0 0
> 0 1
> K 0 0 0 0 0 0 0 0
> 0 0
> GOOG 0 0 0 0 0 0 0 0 0
> 0
> BIDU 0 0 0 0 0 0 0 0
> 0 0
> JNJ 0 1 1 0 0 1 0 0
> 0 0
>
> Say I have this matrix computed. I would like to locate every 1 and the
> corresponding two names that go with it. (eg MMM/ACE, MMM/PEP and so on.)
> Thank you for your help!
>
--
View this message in context: http://r.789695.n4.nabble.com/Grabbing-Column-and-Row-titles-tp4332136p4333698.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list