[R] passing namees

BBands bbands at gmail.com
Tue Aug 29 18:08:19 CEST 2006


R 2.3.1

I wrote a little script to do some cross correlations. The symbols are
in a text file like so:

symbols.txt
ibm
dd
csco

"""
require(tseries)
symbols <- scan("symbols.txt", what = 'character')

for(line in 1:(length(symbols)-1)) {
   assign(symbols[line], get.hist.quote(instrument = symbols[line],
   start = "2005-09-01", quote = "Close"))
   }
# this results in objects ibm, dd... with the last symbol skipped

mat <- cbind(symbols) # this is the problem
(cor_mat <- cor(mat))
symnum(cor_mat)
"""

How can I pass a list of the objects to cbind()? As written cbind gets
only the names of the objects and binds the names not the objects.

Thanks in advance,

     jab
-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.



More information about the R-help mailing list