R 程序如下,读取你附件中的 金龙汽车 股价日线文件,我与http://finance.google.cn/finance/historical?q=SHA:600686作了比较,结果应当是对的。
#####
counter <- 1
col.no<-c()
col.date<- c()
col.open<- c()
col.high<- c()
col.low <- c()
col.close<- c()
col.amount <- c()
col.vol <- c()
fid <- file("sh600686.day","rb")
tempi <- readBin(fid,"int", n=1)
while ( length(tempi) != 0) {
col.no[ counter ] <- tempi
col.date[counter]<-readBin(fid,"int")
col.open[counter]<-readBin(fid,"double",signed=F,size=4)
col.high[counter]<-readBin(fid,"double",signed=F,size=4)
col.low[counter]<-readBin(fid,"double",signed=F,size=4)
col.close[counter]<-readBin(fid,"double",signed=F,size=4)
col.amount[counter]<-readBin(fid,"double",signed=F,size=4)
col.vol[counter]<-readBin(fid,"int")
counter <- counter + 1
tempi <- readBin(fid,"int")
}
close(fid)
data.frame(
col.date=col.date,
col.open=col.open,
col.high=col.high,
col.low=col.low,
col.close=col.close,
col.amount=col.amount,
col.vol=col.vol
)->day
####
呵呵!


雷达卡
京公网安备 11010802022788号







