On 16/07/2012, r-help-requ...@r-project.org <r-help-requ...@r-project.org> wrote: > ------------------------------ > > Message: 77 > Date: Mon, 16 Jul 2012 10:48:39 +0100 > From: Rui Barradas <ruipbarra...@sapo.pt> > To: e-letter <inp...@gmail.com> > Cc: r-help@r-project.org > Subject: Re: [R] histogram of time-stamp data > Message-ID: <5003e377.3000...@sapo.pt> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE) >
Why is it necessary to apply the sample to the current date? Looking at the dataframe, I noticed that values have been changed: file 'test.txt': 12:19:00 09:30:00 16:56:00 01:56:00 10:44:00 10:31:00 02:14:00 05:05:00 12:52:00 21:50:00 R command terminal input: > timestamps<-read.table("test.txt") > timestamps V1 1 12:19:00 2 09:30:00 3 16:56:00 4 01:56:00 5 10:44:00 6 10:31:00 7 02:14:00 8 05:05:00 9 12:52:00 10 21:50:00 > timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE) > write.csv(timestamps,file="test1.txt") test1.txt: "","x" "1",2012-07-16 04:52:48 "2",2012-07-16 21:21:28 "3",2012-07-16 18:58:27 "4",2012-07-16 22:17:25 "5",2012-07-16 11:13:52 "6",2012-07-16 03:17:35 "7",2012-07-16 02:14:17 "8",2012-07-16 14:18:27 "9",2012-07-16 14:39:16 Why is this happening? ______________________________________________ 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.