similar to: Time differences (as.difftime?) issue

Displaying 20 results from an estimated 10000 matches similar to: "Time differences (as.difftime?) issue"

2004 Nov 11
2
RODBC & POSIX & Daylight Saving blues
Dear All, The recent improvement in RODBC to recognize datetimes in tables has exposed my ongoing confusion. All my data are obtained from a satellite system (Argos) which tags events in the GMT time zone. Daylight saving is ignored. To my way of thinking this means that 1. twelve-o-clock means halfway through the day regardless of season, and 2. the difftime of any two dates where
2011 Jul 19
2
strange problem with strptime and date variable
Hello all, I am manipulating a large database with 70,000 records. "strptime" generates a date variable but R treats some of the values as NA. I attach a simple example below. I have spent hours on this problem. Any hint would be greatly appreciated. Many thanks, Edwin Sun # =======start of sample code ============= > x <- c("2005-04-02 19:03:00", "2005-04-03
2012 Mar 19
1
diff(time) vs. difftime?
I just encountered another RTFM problem: With diff(as.POSIXct(...), ...) I was unable to control the units of the results. Examples: > (d.d <- diff(as.POSIXct(c('2012-12-12', '2012-12-13')))) Time difference of 1 days > (d.h <- diff(as.POSIXct(c('2012-12-12 08:00', '2012-12-12 09:00')))) Time difference of 1 hours > (d.m <-
2011 Oct 25
2
difftime producing NA values in R 2.12.2
R-listers, I have noticed several posts on issues with difftime producing NA's but they have been for older versions of R. Here's the issue associated with difftime that I am dealing with in R 2.12.2. > preciptime = strptime("01/10/2007 14:00",format="%m/%d/%Y %H:%M") > class(preciptime) [1] "POSIXlt" "POSIXt" > # Now using difftime, this
2008 Nov 07
2
Unexpected behavior of clocktime related to daylight savings time
Colleagues, I submitted this several days ago and no one responded, so I am trying again, trying a different subject line: I just encountered some unexpected behavior of difftime in relationship to the change from daylight savings to standard time. My understanding is that DST and ST take effect at 2AM. However, the results below suggests that R (version 2.8.0 in OS X) implements the
2007 Nov 01
1
daylight saving / time zone issues with as.POSIXlt/as.POSIXct (PR#10392)
Running under Windows XP 64 bit, as.POSIXlt()/as.POSIXct() seem to think that US time zones (EST5EDT, MST7MDT) switched from daylight savings back to standard time on Oct 28, 2007, whereas the switch is actually on Sun Nov 04, 2007. Examples: > Sys.timezone() [1] "Mountain Daylight Time" > as.POSIXct("2007-10-30 12:38:47") [1] "2007-10-30 12:38:47 Mountain
2008 Jan 27
1
bug in difftime with as.POSIXct
I am trying to do ephemeris calculations in R, which involves calculating an elapsed time. As illustrated below, difftime seems to have problems with my method, since the fractional day is sometimes the correct 0.5 and sometimes the incorrect 0.46. I am doing this on with R-2.6.1 on a powerpc-apple-darwin8.10.1 system. I get the same results for as.POSIXlt() instead of as.POSIXct(), but the
2010 Feb 11
2
difftime result for days not an integer?
Anybody have an idea why I would get a non-integer value for the number of days here? > difftime('2004-08-05','2001-01-03',units='days') Time difference of 1309.958 days Would you just round off? Best, Jon
2013 Jul 09
1
Is difftime a "class"
I am trying to write S4 methods with "difftime" in the signature but am being "informed" (? not a warning or error) that "difftime" is not a class. Nevertheless, dispatch takes place. Should I simply ignore that "information"? Here is a toy example: > setClass("foo", contains = "Date") > setMethod("+", c("foo",
2013 Feb 01
2
difftime() out by 1 hour
I have a problem with results from difftime being 1 hour different than expected. 2 examples are given below: datetime <- matrix(data=rbind(c("2012-03-31 21:00:00", "2012-04-01 00:00:00", "2012-04-01 03:00:00", "2012-04-01 06:00:00"), c("2012-10-06 21:00:00", "2012-10-07 00:00:00", "2012-10-07 03:00:00",
2010 Jan 12
0
Wishlist: Function 'difftime' to honor 'tzone' attribute (PR#14182)
Full_Name: Suharto Anggono Version: 2.8.1 OS: Windows Submission from: (NULL) (125.165.84.118) PR#14076 inspired me to write this. > t1 <- as.POSIXct("1970-01-01 00:00:00", tz="GMT") > t2 <- as.POSIXlt("1970-01-01 00:00:00", tz="GMT") > t1 - t2 Time difference of 7 hours Above, t1 and t2 represent the same time in the same specified
2008 Nov 03
0
Unexpected behavior of difftime in relationship to daylight savings time
Colleagues, I just encountered some unexpected behavior of difftime in relationship to the change from daylight savings to standard time. My understanding is that DST and ST take effect at 2AM. However, the code below suggests that R (version 2.8.0 in OS X) implements the change at 2:16AM: Expected: > > difftime("2008-11-02 02:01:00", "2008-11-02 00:59:00")
2013 Apr 30
3
Subset of a 'table' divided by a 'table' is a 'table', but printed by 'print.default'
This is just info. I recently got something like this. > x <- factor(c("A","A","B","B"), levels=c("A","B")) > y <- factor(c("a","b","a","b"), levels=c("a","b")) > table(x, y)[, "a"] / table(x) x A B 0.5 0.5 attr(,"class") [1]
2010 Oct 25
2
difftime error
R community, I am trying to create an array of the time differences between datapoints for a very large set. For some reason for 4 of the values the difference has been calculated as NA. Looking at the individual points two of them are "1981-03-29 01:40:00" and "1981-03-29 02:00:00" This is the exact same format as the other points that return values of 20 mins as expected.
2009 Feb 06
1
Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: "limited arithmetic is available on 'difftime' objects"; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error:
2009 Feb 06
1
Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: "limited arithmetic is available on 'difftime' objects"; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error:
2010 Mar 18
1
probable timezone confusion with as.yearmon
It looks like a timezone issue, and it's causing confusion to me at least. My original data: gmt <- c("19880101 0000", "19880101 0100", "19880101 0300", "19880101 0400", "19880101 0500", "19880101 0600") These were converted to local dates/times with akst<-strptime(gmt,format="%Y%m%d %H%M")-(3600*9) # because I want
2006 Apr 03
1
weird "max" behavior for difftime class
If you apply the "max" function to a vector of class "difftime" with units="days", the returned value is in units of "seconds". Is this not a bug? At any rate it can lead to confusing results if one buries a call to "max" deep in some data analysis code. Details: > y<-structure(1, class = "difftime", units = "days")
2010 Jun 22
1
New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())
On Thu, Jun 10, 2010 at 3:39 PM, Gustaf Rydevik <gustaf.rydevik at gmail.com> wrote: > Hi all, > > The recent change in 2.11 that made as.numeric() return false on > difftime-objects broke some of my code that calculated age classes of > individuals using cut(). While this was no big thing to fix for me, it > might be wise > to provide a cut.difftime method to ?stop
2010 Jun 22
1
New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())
On Thu, Jun 10, 2010 at 3:39 PM, Gustaf Rydevik <gustaf.rydevik at gmail.com> wrote: > Hi all, > > The recent change in 2.11 that made as.numeric() return false on > difftime-objects broke some of my code that calculated age classes of > individuals using cut(). While this was no big thing to fix for me, it > might be wise > to provide a cut.difftime method to ?stop