similar to: Problem with +(POSIXt, difftime) dispatching -- WAS: How to create sequence of constant time interval

Displaying 20 results from an estimated 7000 matches similar to: "Problem with +(POSIXt, difftime) dispatching -- WAS: How to create sequence of constant time interval"

2009 Nov 16
0
(Date + difftime) and (POSIXt + difftime) does not use date/time arithmetics (PR#14067)
Full_Name: Suharto Anggono Version: 2.8.1 OS: Windows Submission from: (NULL) (125.165.81.48) There is already PR#13369. But, the problem is not just the warning. C:\Program Files\R\R-2.8.1\bin>R --vanilla R version 2.8.1 (2008-12-22) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome
2007 Feb 21
1
Adding difftime objects to POSIXt objects
Hello, ?DateTimeClasses states that "one can add or subtract a number of seconds or a 'difftime' object from a date-time object, but not add two date-time objects." So, is the below expected behavior? > x <- Sys.time() > x [1] "2007-02-21 16:19:56 CST" > x + as.difftime("1","%H") [1] "2007-02-21 16:19:57 CST" Warning
2007 Oct 08
2
Incompatible methods ("-.POSIXt", "Ops.difftime") for "-"
Dear all, according to the Help-page of DateTimeClasses {base} I should be able to do time - z with time date-time objects z a numeric vector (in seconds) or an object of class "difftime". However, on R version 2.6.0 (Windows XP) I get > Sys.time() - as.difftime(c("0:3:20", "11:23:15")) Time differences in mins [1] 1191837998 1191837318
2009 Nov 19
0
Wishlist: In documentation, say that `+.Date`(Date, difftime) should be called directly or remove 'or an object of class "difftime"' (PR#14072)
Full_Name: Suharto Anggono Version: 2.8.1 OS: Windows Submission from: (NULL) (125.161.134.206) About PR#14067, now I understand why (Date + difftime) does not use '+.Date'. But, before I understand, it was surprising. The surprise is also reflected in the post "Problem with +(POSIXt, difftime) dispatching -- WAS: How to create sequence of constant time interval" in R-help
2007 Dec 14
3
How to convert Datetime numbers from Excel to POSIXt objects
Hi all, I need to compare time series data files of different time formats. I had no problems with text format using strptime. But how can I convert datetime numbers from Excel (days since 30.12.1899 00:00:00) into POSIXt objects? For example 29770.375 should be converted to "03.07.1981 09:00:00" I tried the following code and encountered strange results: t1-t0 gives 29770.33
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 <-
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:
2002 Mar 26
1
seq.POSIXt() with short time intervals
I was surprised when seq.POSIXt() returned a single value rather than a vector, from inputs that I thought were reasonable. Here's an example to illustrate: > t0 <- ISOdatetime(2002,6,24,0,0,10) ## expected a sequence of 16 times 1 second apart > seq.POSIXt(from=t0,to=t0+15,by='1 sec') [1] "2002-06-24 00:00:10 PDT" ## traces to this call >
2011 Aug 14
2
Trouble: Time Difference with difftime
Hello all!!! I want to measure the duration of events (given a start and an end time). The catch is that I require the output in calender days. This means: 02-Jan-2011 00:01:00 minus 01-Jan-2011 23:59:00 should be 1 day (although the real time difference is only 2 minutes) My data is the following head(episode.ct) [1] "2009-07-13 13:37:20 CEST" "2009-07-14 07:29:20 CEST"
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 May 14
1
Time differences (as.difftime?) issue
Dear all, I have a vector generated using the function strptime: > my.dt [1] "2004-04-19 08:35:00 W. Europe Daylight Time" "2004-04-19 09:35:00 W. Europe Daylight Time" "2004-04-19 11:35:00 W. Europe Daylight Time" [4] "2004-04-19 13:35:00 W. Europe Daylight Time" "2004-04-20 07:50:00 W. Europe Daylight Time" > class(my.dt) [1]
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 Dec 09
3
difftime
Hi. I'm trying to take the difference in days between two times. Can you point out what's wrong, or suggest a different function? When I try the following code, The following code works fine: a <- strptime(1911100807,format="%Y%m%d%H",tz="GMT") b <- strptime(1911102718,format="%Y%m%d%H",tz="GMT") x <- difftime(b, a,
2011 Feb 14
3
how to order POSIXt objects ?
I have a problem ordering by descending magnitude a POSIXt object. Can someone help please and let me know how to work around this. My goal is to be able to order my data by DATE and then by descending TIME. I have tried to include as much info as possible below. The problem stems from trying to read in times from a CSV file. I have converted the character time values to a POSIXt object using the
2002 Oct 17
4
Posix Problem, difftime
I am having a series of problems using date time data that has been converted into a POSIXt and POSIXlt classes. I have hourly time series data from 1900 that has been converted from text data. I assume most of my problems come from a mis-underdanding of the POSIX class. My matrix named (aa) for this year is approx 8700 by 4. When I try to calculate the length of posit column ( which is the
2008 May 21
3
Converting a 'difftime' to integer - How to???
I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data to achive this. Something like: > d <- as.Date("2006-03-13") - as.Date("2006-01-01") +1 > d Time difference of 72 days So far so good. But d is a 'difftime' object. How do I get an Integer value from that? I tried severel things, incuding the
2002 Mar 26
0
seq.default test for relative range (PR#1416)
seq.default() tests for the relative range of the from and to arguments (see excerpt below) and returns from (only) when the relative range is small. The problem is that "small" is too large. Also undocumented. At 17:25 +0000 3/26/02, ripley@stats.ox.ac.uk wrote: >On Tue, 26 Mar 2002, Don MacQueen wrote: > >> I was surprised when seq.POSIXt() returned a single value
2005 Apr 30
3
as.numeric method for objects of class "difftime"
I have just become painfully aware that objects of class "difftime", generated by the difference of two POSIXct objects, carry a "units" attribute, which flashes by when the object is printed, for example. The pain was occasioned when I tried to turn these objects into numberic objects for use elsewhere as a covariate. as.numeric(difftime object) simply turns off the units
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