Thanks! it was really helpful. soichi
2013/1/7 arun <smartpink...@yahoo.com> > Hi, > Try this: > dat1<-read.table(text="1 2012-07-01 00:57:54 +0900 156 > 2 2012-07-01 01:07:41 +0900 587 > 3 2012-07-01 01:09:31 +0900 110 > 4 2012-07-01 01:18:42 +0900 551 > 5 2012-07-01 01:39:01 +0900 1219 > 6 2012-07-01 01:40:40 +0900 > 99",sep="",header=FALSE,stringsAsFactors=FALSE) > > dat2<-data.frame(date=paste(dat1[,2],dat1[,3],paste0("+",dat1[,4]),sep=" > "),Interval=dat1[,5]) > dat2$date<-as.POSIXct(dat2$date,"%Y-%m-%d %H:%M:%S") > library(xts) > dat3<-xts(dat2[,-1],order.by=dat2[,1]) > plot(dat3) > A.K. > > > > > ----- Original Message ----- > From: ishi soichi <soichi...@gmail.com> > To: r-help <r-help@r-project.org> > Cc: > Sent: Monday, January 7, 2013 3:55 AM > Subject: [R] plot x-axis DateTime NOT evenly spaced > > R-64 latest > > Hi. I am trying to plot a set of csv data, which looks like > > > head(interval) > date inteval > 1 2012-07-01 00:57:54 +0900 156 > 2 2012-07-01 01:07:41 +0900 587 > 3 2012-07-01 01:09:31 +0900 110 > 4 2012-07-01 01:18:42 +0900 551 > 5 2012-07-01 01:39:01 +0900 1219 > 6 2012-07-01 01:40:40 +0900 99 > > as you can see, more than one event happens each day, and they are not > evenly spaced. Obviously hours, minutes and seconds are important for the > plot. > > I tried > > interval$date <- as.Date(interval$date, "%Y-%m-%d %H:%M:%S +0900") > > but this chops the time off. > > Could anyone show me how to plot data with x values as Date(or Time) > objects? > > soichi > > [[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. > > [[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.