Hi, I didn't understand ">". Lines1<-textConnection("Date Time Close 10/15/12 09:00:00 252.40 10/15/12 09:01:00 253.10 10/15/12 09:02:00 253.15 10/15/12 09:03:00 253.30 10/15/12 09:04:00 253.25 10/15/12 09:05:00 253.45") library(zoo) library(xts) z<- read.zoo(Lines1,header=TRUE,index=list(1,2),FUN=function(d,t) as.chron(paste(as.Date(chron(d)),t))) zc<-as.xts(z) colnames(zc)<-"Close" zc # Close #(10/15/12 09:00:00) 252.40 #(10/15/12 09:01:00) 253.10 #(10/15/12 09:02:00) 253.15 #(10/15/12 09:03:00) 253.30 #(10/15/12 09:04:00) 253.25 #(10/15/12 09:05:00) 253.45
length(as.list(zc$Close)) #[1] 1 1:length(zc$Close) #[1] 1 2 3 4 5 6 plot(z) #works plot(1:length(zc$Close),split(zc$Close,row(zc))) #should also work A.K. ----- Original Message ----- From: 박상규 <birdfir...@naver.com> To: r-help@r-project.org Cc: Sent: Wednesday, December 19, 2012 2:45 AM Subject: [R] How to convert xts data into list Hello, How can I convert Close colume of the below xts time series data into a list of Close values ? I'd like to plot Close values as a list. > head(zc) Close (10/15/12 09:00:00) 252.40 (10/15/12 09:01:00) 253.10 (10/15/12 09:02:00) 253.15 (10/15/12 09:03:00) 253.30 (10/15/12 09:04:00) 253.25 (10/15/12 09:05:00) 253.45 I tried the below command to plot it. But it failed. > plot(1:length(zc$Close),as.list(zc$Close)) Thanks in advance, SK Park [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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. ______________________________________________ R-help@r-project.org mailing list 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.