Hello, I attach the sample data in the email and you can use the data to try my code. My code is as follow.
library('highfrequency') library('xts') data=read.table("sample data.csv",header=F,skip = 1,stringsAsFactors=FALSE,sep="\t") colnames(data)=c(" ",'SYMBOL',"PRICE","PERMNO") id <- unique(data$PERMNO) mydata <- data.frame() for (i in id){ tmp <-data[data$PERMNO==i,] row.names(tmp)=tmp[,1] tmp=tmp[,-1] tmp.xts <- as.xts(tmp, order.by=as.POSIXlt(rownames(tmp),format="%Y/%m/%d %H:%M")) mydata <- rbind(mydata,tmp.xts) } The problem is that when I try to program tmp.xts <- as.xts(tmp, order.by=as.POSIXlt(rownames(tmp),format="%Y/%m/%d %H:%M")), then I get NaN rownames. I don't know why. Thanks very much. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.