|
如何高效地实现以下的代码? 采用循环的方式操作每一个变量?
library(quantmod)
pfyh <- getSymbols("600000.ss", auto.assign = F)
msyh <- getSymbols("600016.ss", auto.assign = F)
sgjt <- getSymbols("600018.ss", auto.assign = F)
zgsh <- getSymbols("600028.ss", auto.assign = F)
bldc <- getSymbols("600048.ss", auto.assign = F)
pfyh.ret <- dailyReturn(pfyh[,4])
msyh.ret <- dailyReturn(msyh[,4])
sgjt.ret <- dailyReturn(sgjt[,4])
zgsh.ret <- dailyReturn(zgsh[,4])
bldc.ret <- dailyReturn(bldc[,4])
rm(list = c("pfyh", "msyh", "zgsh", "sgjt", "bldc"))
pfyh.ret <- na.omit(pfyh.ret)
msyh.ret <- na.omit(msyh.ret)
sgjt.ret <- na.omit(sgjt.ret)
zgsh.ret <- na.omit(zgsh.ret)
bldc.ret <- na.omit(bldc.ret)
|
|