Hello all, I'm getting much further with my time-series work, but still getting into some problems. I'm using POSIXct time format with both date and time. I'd like to use that in an its object but It seems its only processes the date part of the POSIX time stamps: BMU_its_data <- its(data[BMUindex,2-4],dates=data[BMUindex,1]) Error in `row.names<-.data.frame`(`*tmp*`, value = c("2007-10-31", "2007-10-31", : The first column of the data is certainly correct, with both date and time: > summary(data[BMUindex,1]) Min. 1st Qu. Median "2007-10-31 07:00:00 UTC" "2007-11-01 07:00:00 UTC" "2007-11-03 07:00:00 UTC" Mean 3rd Qu. Max. "2007-11-02 21:44:12 UTC" "2007-11-04 07:00:00 UTC" "2007-11-05 08:00:00 UTC" Perhaps the functions used in its are unable to see the time field. I noticed that using unique() on the same data gives me only 6 different values, one for each day, with the times ignored. Is there any time format I can use in R (through its or zoo or fCalendar or anything) that allows me to use tools such as unique() and so on and have the times (not only dates) considered? I've chosen its because it seems to have pretty good ts specific plotting stuff in there, but I'd be willing to use anything that allows me to work with my POSIX dates down to the second. (or even msec) Thanks. B. Bogart
Armstrong, Whit
2007-Nov-05 20:54 UTC
[R] its does not recognize POSIXct w/ both time and Date?
can you please give an example that I can cut from your email and run on my machine?> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of B. Bogart > Sent: Monday, November 05, 2007 3:51 PM > To: r-help at r-project.org > Subject: [R] its does not recognize POSIXct w/ both time and Date? > > Hello all, > > I'm getting much further with my time-series work, but still > getting into some problems. > > I'm using POSIXct time format with both date and time. > > I'd like to use that in an its object but It seems its only > processes the date part of the POSIX time stamps: > > BMU_its_data <- its(data[BMUindex,2-4],dates=data[BMUindex,1]) > Error in `row.names<-.data.frame`(`*tmp*`, value = > c("2007-10-31", "2007-10-31", : > > > The first column of the data is certainly correct, with both > date and time: > > > summary(data[BMUindex,1]) > Min. 1st Qu. > > Median > "2007-10-31 07:00:00 UTC" "2007-11-01 07:00:00 UTC" > "2007-11-03 07:00:00 > UTC" > Mean 3rd Qu. > > Max. > "2007-11-02 21:44:12 UTC" "2007-11-04 07:00:00 UTC" > "2007-11-05 08:00:00 > UTC" > > Perhaps the functions used in its are unable to see the time field. I > noticed that using unique() on the same data gives me only 6 > different > values, one for each day, with the times ignored. > > Is there any time format I can use in R (through its or zoo > or fCalendar > or anything) that allows me to use tools such as unique() and > so on and > have the times (not only dates) considered? > > I've chosen its because it seems to have pretty good ts specific > plotting stuff in there, but I'd be willing to use anything > that allows > me to work with my POSIX dates down to the second. (or even msec) > > Thanks. > B. Bogart > > ______________________________________________ > 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. >This e-mail message is intended only for the named recipient(s) above. It may contain confidential information. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and delete the message and any attachment(s) from your system. Thank you.
Gabor Grothendieck
2007-Nov-05 21:18 UTC
[R] its does not recognize POSIXct w/ both time and Date?
On Nov 5, 2007 3:50 PM, B. Bogart <bbogart at sfu.ca> wrote:> Hello all, > > I'm getting much further with my time-series work, but still getting > into some problems. > > I'm using POSIXct time format with both date and time. > > I'd like to use that in an its object but It seems its only processes > the date part of the POSIX time stamps: > > BMU_its_data <- its(data[BMUindex,2-4],dates=data[BMUindex,1]) > Error in `row.names<-.data.frame`(`*tmp*`, value = c("2007-10-31", > "2007-10-31", : > > > The first column of the data is certainly correct, with both date and time: > > > summary(data[BMUindex,1]) > Min. 1st Qu. > Median > "2007-10-31 07:00:00 UTC" "2007-11-01 07:00:00 UTC" "2007-11-03 07:00:00 > UTC" > Mean 3rd Qu. > Max. > "2007-11-02 21:44:12 UTC" "2007-11-04 07:00:00 UTC" "2007-11-05 08:00:00 > UTC" > > Perhaps the functions used in its are unable to see the time field. I > noticed that using unique() on the same data gives me only 6 different > values, one for each day, with the times ignored. > > Is there any time format I can use in R (through its or zoo or fCalendar > or anything) that allows me to use tools such as unique() and so on and > have the times (not only dates) considered? > > I've chosen its because it seems to have pretty good ts specific > plotting stuff in there, but I'd be willing to use anything that allows > me to work with my POSIX dates down to the second. (or even msec) >Please provide reproducible examples as asked in last line on every message to r-help. Its unlikely that 'its' ignores date fields but perhaps this will get you going. Each of these gives the first value and its time for each value that occurs in the series:> # its > library(its) > ii <- its(rep(1:2, 5), Sys.time() + 1:10) > ii[!duplicated(ii)]An object of class "its" 1 20071105 1 20071105 2 Slot "dates": [1] "2007-11-05 16:03:09 Eastern Standard Time" [2] "2007-11-05 16:03:10 Eastern Standard Time"> # zoo > library(zoo) > z <- zoo(rep(1:2, 5), Sys.time() + 1:10) > z[!duplicated(z)]2007-11-05 16:03:10 2007-11-05 16:03:11 1 2
Reasonably Related Threads
- Error: Cannot Coerce POSIXt to POSIXct when building package
- How to format data for time-series analysis
- date sequencing using the Fcalendar package
- Apparent bug in summary.data.frame() with columns of Date class and NA's present
- using image to show RGB image data ?