Dear-
Let c:\\aa.txt have
BAC
DD
MSFT
ZTS
It is well-known that, in R,
install.packages("quantmod")
library(quantmod)
WatchList <- as.vector(as.matrix(read.csv(file="c:\\aa.txt", header=FALSE)))
getSymbols(WatchList,from ="2014-01-01")
gives us 4 daily prices (roughly 250) for this year.
*********************************************************
Now, when we like to make a matrix (250 row and 4 columns) with ONLY daily closes of the 4 stocks
Obviously cbind(BAC[,4], DD[,4], MSFT[,4], ZTS[,4]) gives us an answer.
********************************************************
However, when our WatchList contains 500 symbols (similar to SnP500), instead of the above 4, what is the appropriate R commands?
Please do NOT tell me to type the time-consuming 500 symbols with [,4].
Let c:\\aa.txt have
BAC
DD
MSFT
ZTS
It is well-known that, in R,
install.packages("quantmod")
library(quantmod)
WatchList <- as.vector(as.matrix(read.csv(file="c:\\aa.txt", header=FALSE)))
getSymbols(WatchList,from ="2014-01-01")
gives us 4 daily prices (roughly 250) for this year.
*********************************************************
Now, when we like to make a matrix (250 row and 4 columns) with ONLY daily closes of the 4 stocks
Obviously cbind(BAC[,4], DD[,4], MSFT[,4], ZTS[,4]) gives us an answer.
********************************************************
However, when our WatchList contains 500 symbols (similar to SnP500), instead of the above 4, what is the appropriate R commands?
Please do NOT tell me to type the time-consuming 500 symbols with [,4].