Displaying 20 results from an estimated 10000 matches similar to: "What determines the unit of POSIXct differences?"
2008 Apr 09
2
fuzzy merge
Hi,
I would like to merge two data frames. It is just that I want the merging to be done with some kind of a fuzzy criterion. Let me explain.
My first data frame looks like this :
ID1 time1 dt
1 2008-01-02 13:11 10
2 2008-01-02 14:20 20
3
2004 Apr 23
3
time zones in POSIXt
Hi,
I have two data sources. One records time in PST time zone, the other in
GMT. I want to compute the difference between the two, but don't see
how. Here is an example where I compute time difference between
identical times each (meant to be) relative to its time zone.
> as.POSIXlt("2000-05-10 10:15:00", "PST") - as.POSIXlt("2000-05-10
10:15:00",
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"
2010 Sep 02
2
date
Hello all,
I've 2 strings that representing the start and end values of a date and
time.
For example,
time1 <- c("21/04/2005","23/05/2005","11/04/2005")
time2 <- c("15/07/2009", "03/06/2008", "15/10/2005")
as.difftime(time1,time2)
Time differences in secs
[1] NA NA NA
attr(,"tzone")
[1] ""
How can i
2010 Feb 23
3
difference between date and times
Hi,
I have date and time in a format like this: " 2007-02-21 05:19:00".
Do you which function i can use to derterminate the difference in time between this value and an other one.
For exemple:
this one : 2007-02-21 05:19:00
and this one : 2007-02-20 14:21:53
Thanks a lot,
Karine H.
_________________________________________________________________
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
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]]
2012 Dec 13
1
duplicated.data.frame() and POSIXct with DST shift
Hi,
I encountered the behavior, that the duplicated method for data.frames gives "false positives" if there are columns of class POSIXct with a clock shift from DST to standard time.
time <- as.POSIXct("2012-10-28 02:00", tz="Europe/Vienna") + c(0, 60*60)
time
[1] "2012-10-28 02:00:00 CEST" "2012-10-28 02:00:00 CET"
df <-
2003 Jun 05
1
question about POSIXct conversion
Hello!
I am trying to compute minimal time on some data like this:
mt<-tapply(mrsh$time1,list(mrsh$var1,mrsh$var2),min):
a b
145 1054800600 1054789800
340 1054804500 1054794600
349 1054820400 1054792800
55 1054800600 1054789200
57 1054814100 1054791000
78 1054822200 1054790400
843
2010 Aug 20
2
Problem with POSIXct in ave
Hi,
I am having trouble using the ave function with a POSIXct object. For
example:
x<-Sys.time()+0:9*3600
dat<-data.frame(id=rep(c('a','
b','c'),each=10),dt=rep(x,3),i=rep(1:10,3))
dat
# This is what I want to do:
dat$time.elapsed<-unsplit(lapply(split(dat$dt,dat$id),function(x)
x-x[1]),f=dat$id)
dat
# The above code does the trick, but from the standpoint of
2012 Jun 15
2
Wrong computation of time differenze in POSIXct - additional digits
Hello,
I wanted to compute the time differenze between to times:
first =as.POSIXct( "2012-06-15 16:32:39.0025 CEST")
second = as.POSIXct("2012-06-15 16:32:39.0086 CEST")
second - first
The result is
Time difference of 0.006099939 secs
instead of just 0.0061 secs
So R adds aditional numbers after the result.
I know I could round it in this case.
But I am working with a
2013 Apr 26
3
converting character matrix to POSIXct matrix
I thought this is a common question but rseek/google searches don't yield
any relevant hit.
I have a matrix of character strings, which are time stamps,
> time.m[1:5,1:5]
[,1] [,2] [,3] [,4] [,5]
[1,] "08:00:20.799" "08:00:20.799" "08:00:20.799" "08:00:20.799"
"08:00:20.799"
[2,]
2014 Aug 25
5
problema con campos que tienen formato fecha
Hola Javier,
Muchas gracias por responder tan rápido!
Yo trabajo en Mac OS X 10.9.4.
Versión 0.98.953 de RStudio.
Versión 3.0.2 (2013-09-25) de R.
##
Este es el script que estoy trabajando. Se trata de una rutina para
automatizar el cálculo de la duración del evento.
setwd("/Users/angelacamargosanabria/Documents/ANGELITA/1-DOC/1-TESIS/4-PAPERS/1-Mamiferos/DATOS/Bases")
BASE <-
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
2004 Aug 19
2
proposed change to [.POSIXct
R developers,
The "tzone" attribute is stripped from a POSIXct object when the subscript
command is called ("[.POISXct"). This results in dates being printed in the
locale specific format after a subscript operation is applied to a POSIXct
object which has cause several problems for me in the past.
Here is an example of this problem under R 1.9.1:
> x <-
2007 Jun 20
2
Computing time differences
Dear R users,
I have a problem computing time differences using R.
I have a date that are given using the following format: 20080620.00, where
the 4 first digits represent the year, the next 2 ones the month and the last
2 ones the day. I would need to compute time differences between two vectors
of this given format.
I tried around trying to change this format into any type of time serie
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
2007 Jan 19
4
Newbie question: Statistical functions (e.g., mean, sd) in a "transform" statement?
Greetings listeRs -
Given a data frame such as
times
time1 time2 time3 time4
1 70.408543 48.92378 7.399605 95.93050
2 17.231940 27.48530 82.962916 10.20619
3 20.279220 10.33575 66.209290 30.71846
4 NA 53.31993 12.398237 35.65782
5 9.295965 NA 48.929201 NA
6 63.966518 42.16304 1.777342 NA
one can use "transform" to
2010 Nov 15
3
merge two dataset and replace missing by 0
Hi r users,
I have two data sets (X1, X2). For example,
time1<-c( 0, 8, 15, 22, 43, 64, 85, 106, 127, 148, 169, 190 ,211 )
outpue1<-c(171 ,164 ,150 ,141 ,109 , 73 , 47 ,26 ,15 ,12 ,6 ,2 ,1 )
X1<-cbind(time1,outpue1)
time2<-c( 0 ,8 ,15 , 22 ,43 , 64 ,85 ,106 ,148)
output2<-c( 5 ,5 ,4 ,5 ,5 ,4 ,1 ,2 , 1 )
X2<-cbind(time2,output2)
I want to
2006 Oct 27
2
POSIXct time zone and daylight savings issues
Hello,
Suppose we need a function that takes a POSIXct object and need to
calculate the time difference between it and GMT time:
gmtDiff <- function(time) {
time.gmt <- as.POSIXct(format(time, tz="GMT"))
time.plt <- as.POSIXlt(time)
dlstime <- ifelse(time.plt$isdst > 0, 1, 0)
timezone <- as.numeric(difftime(time, time.gmt, units="hours"))