Readers, A data set consists of time-stamp values: 00:00:00 23:11:00 06:22:00 The data set was imported: timestamps<-read.table("path/to/timestampsvalues") hist(timestamps) ...error... x must be numeric Then tried: plot(timestamps). How to adjust the graph to create a histogram where the intervals ranges can be specified, e.g. intervals of 60 minutes? Thanks in advance.
pDates<-as.POSIXct(times,format="%H:%M:%S")> hist(pDates,"hours")On 16.07.2012, at 10:47, e-letter wrote:> Readers, > > A data set consists of time-stamp values: > > 00:00:00 > 23:11:00 > 06:22:00 > > The data set was imported: > > timestamps<-read.table("path/to/timestampsvalues") > hist(timestamps) > > ...error... x must be numeric > > Then tried: > > plot(timestamps). > > How to adjust the graph to create a histogram where the intervals > ranges can be specified, e.g. intervals of 60 minutes? > > Thanks in advance. > > ______________________________________________ > 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]]
Hello, Try the following. timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE) h1 <- cut(timestamps, breaks="hour") h2 <- cut(timestamps, breaks="15 mins") op <- par(mfrow=c(1, 2)) hist(as.integer(h1)) hist(as.integer(h2)) par(op) Hope this helps, Rui Barradas Em 16-07-2012 09:47, e-letter escreveu:> Readers, > > A data set consists of time-stamp values: > > 00:00:00 > 23:11:00 > 06:22:00 > > The data set was imported: > > timestamps<-read.table("path/to/timestampsvalues") > hist(timestamps) > > ...error... x must be numeric > > Then tried: > > plot(timestamps). > > How to adjust the graph to create a histogram where the intervals > ranges can be specified, e.g. intervals of 60 minutes? > > Thanks in advance. > > ______________________________________________ > R-help at 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. >