[R] Indirect references

Back2Numbers back2numbers at gmail.com
Sun Nov 13 14:10:23 CET 2011


Hi All,

I would like to work with symbols referenced by strings: I would like to 
manipulate data/symbols referencing to them by the string name of the 
symbol.

An example will be clearer. Let's I get a time series through quantmod

 > getSymbols("GLD")

This will create a new symbol GLD with the relevant data. I have tried 
to rename the column names as follows:

 > colnames(get("GLD")) <- c("open", "close", "low", "high", "volume", 
"adjusted")

will give the following error:

Error in colnames("GLD")<- c("open", "close", "low", "high", "volume",  :
   target of assignment expands to non-language object


I am confused as to how to do this.

(the intent of this is to maintain a list of tickers in string format 
and loop through them at ease to do whatever treatment)


Thanks for your help,

Emmanuel



More information about the R-help mailing list