similar to: Re sults sometimes in seconds with difftime unit=mins

Displaying 20 results from an estimated 9000 matches similar to: "Re sults sometimes in seconds with difftime unit=mins"

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 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,
2018 Aug 01
1
RFC: make as.difftime more consistent or convenient
Hello! you, Emil Bode <emil.bode at dans.knaw.nl>, wrote on Tuesday, July 31, 2018 1:55 PM: > Some of the changes you're proposing could be made (with effort), but note that you're not > restricted to providing strings with a format. > What you're trying to do can be accomplished with as.difftime(12, units='weeks'), see also > ?as.difftime > > Or if
2006 Mar 15
2
difftime arguments
Hi I just started using RGui.exe under widnows. I have a text file containing date arranged in columns and rows, each column has the same format, each row with different formats. 3 of the columns are something like this 1/12/2006 3:59:45 PM I need to calculate the different in seconds between 2 selected periods using their row’s index My solution: Read the file in a data frame and
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]
2008 Nov 17
2
re sults from "do.call" function
Dear R users... I made this by help of one of R users. _________________________________________________________________ X=matrix(seq(1,4), 2 , 2) B=matrix(c(0.6,1.0,2.5,1.5) , 2 , 2) func <- function(i,y0,j) { y0*exp(X[i,]%*%B[,j]) } list1 <- expand.grid( i=c(1,2) , y0=c(1,2) , j=c(1,2) ) results <- do.call( func , list1 )
2007 Mar 22
2
R difftime function: How can we fix the difftime unit?
Hi, I am trying to take difference of two time objects. I want to fix the result's unit to minutes. How can I do that? Here is an example: > difftime(x, y) Time difference of 2.030720 hours > difftime(x, z) Time difference of 30.34672 mins where x = '2007-03-05 08:32:58' y = '2007-03-05 06:31:07' and z = '2007-03-05 08:02:37' How can I get answer
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
2010 Apr 05
1
using difftime()
I'm new to R and have the following problem with difftime: if I directly assign date/time strings in difftime I get the expected result: > a<-"2010-03-23 10:52:00" > a [1] "2010-03-23 10:52:00" > b<-"2010-03-23 11:53:00" > u2<-as.difftime(c(a,b), format ="%Y-%m-%d %H:%M:%S", units="mins") > u2 Time differences in mins
2009 Feb 17
0
Problem with +(POSIXt, difftime) dispatching -- WAS: How to create sequence of constant time interval
There seems to be a problem in the way `+` is dispatched for POSIXt/difftime (R 2.8.0 Windows). With the following definitions: t0 <- as.POSIXct('2009-01-01 00:00') halfhour.mins <- as.difftime(30,units='mins') I would have thought that the straightforward answer to Suresh's question would be something like t0 + halfhour.mins * (0:47) And indeed, if we
2009 Mar 17
1
Mean of difftime vectors : "code infelicity" or intended behaviour ?
Dear list, "+" (and "-") being defined for difftime class, I expected mean() to return something sensible. This is only half-true : > mean(c(1:5, 5:1),na.rm=TRUE) [1] 3 > mean(as.difftime(c(1:5, 5:1),unit="mins"),na.rm=TRUE) Time difference of 3 mins Fine so far. However : > mean(c(1:5, NA,5:1),na.rm=TRUE) [1] 3 > mean(as.difftime(c(1:5,
2007 Feb 23
0
Formatting difftime objects
I like the new difftime functionality. Here's a dataframe of 5k run times: > r5k race date totaltime pace mile 1 RUDOLPH 2004-12-03 19:00:00 27.76667 mins 8.937224 mins 3.106856 2 RUDOLPH 2005-12-02 18:30:00 25.28333 mins 8.137916 mins 3.106856 3 FROSTBITE 2005-12-10 07:00:00 24.75000 mins 7.966253 mins 3.106856 4 JUDICATA 2006-03-04
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
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
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")
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
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 <-
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.
2018 Jul 31
0
RFC: make as.difftime more consistent or convenient
Hello! I notice I can convert strings containing hour, minute or second specifications to a 'difftime': > as.difftime("12 h", "%H") Time difference of 12 hours > as.difftime("12 m", "%M") Time difference of 12 mins > as.difftime("12 s", "%S") Time difference of 12 secs But I can't do so with a week specification,
2011 Sep 15
1
difftime on vector
How can I apply difftime to a vector of sorted dates? I can do this just fine with diff, but difftime doesn't seem to take in a vector. > diff(r$BOOKING_DATE) Works. Great! > difftime(r$MY_DATE, units="days") Error in as.POSIXct(time2) : argument "time2" is missing, with no default Thanks, Bradford [[alternative HTML version deleted]]