Displaying 20 results from an estimated 10000 matches similar to: "Problem with POSIXct in ave"
2009 Sep 11
1
What determines the unit of POSIXct differences?
Dear All,
what determines if a difference between POSIXct objects gets
expressed in days or seconds?
In the following example, it's sometimes seconds, sometimes days.
as.POSIXct('2009-09-01') - as.POSIXct(NA)
Time difference of NA secs
c(as.POSIXct('2009-09-01'), as.POSIXct(NA)) -
c(as.POSIXct('2009-09-01'), as.POSIXct('2009-08-31'))
Time differences in
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]
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
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
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 <-
2009 Jun 23
3
subset POSIXct
Hi,
I have a data frame with two columns: dt and tf. The dt column is
datetime and the tf column is a temperature.
dt tf
1 2009-06-20 00:53:00 73
2 2009-06-20 01:08:00 73
3 2009-06-20 01:44:00 72
4 2009-06-20 01:53:00 71
5 2009-06-20 02:07:00 72
...
I need a subset of the rows where the minutes are 53. The hour is
immaterial. I can not find a wildcard
2009 May 20
2
Class for time of day?
What is the recommended class for time of day (independent of calendar
date)?
And what is the recommended way to get the time of day from a POSIXct
object? (Not a string representation, but a computable representation.)
I have looked in the man page for DateTimeClasses, in the Time Series
Analysis Task View and in Spector's Data Manipulation book but haven't found
these. Clearly I can
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"))
2011 Mar 08
1
Date arithmetic coerces POSIXlt to POSIXct?
Hi. This feels like a bug to me, or at least an undocumented feature,
but I thought I'd see what people here thought of it. Consider a POSIXlt
object like this one:
> a <- as.POSIXlt ("2011-01-23 12:45:45")
> class (a)
[1] "POSIXlt" "POSIXt"
Fine. Now, if I do some arithmetic on that object, the result is
converted to POSIXct.
> class (a
2012 Apr 30
1
Subtract days to dates in POSIXct format
Hello,
I'm having problems working with date values in POSIXct format. Here is what I got (eg.lig attached):
x <- read.table("eg.txt", sep = ',', col.names=c("ok","time","secs","lig")) # it gives time as factor
z <- cbind(x,colsplit(x$time, split="\\s", names=c("date", "clock")))
2006 Feb 21
3
Number of Days Between Dates: Incorrect Results For Date Calucations.
In some cases, incorrect results are produced by the code below intended to
calculate the number of days between 2 dates. The year in question was a
leap year.
Note the results for 2004-04-04 and 2004-04-05 are the same! They should be
37 and 38 respectively.
> as.integer(as.POSIXct("2004-04-02") - as.POSIXct("2004-02-27"))
[1] 35
>
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 Sep 19
2
fechas ??
Hola a todos:
Tengo un problema con las fechas, básicamente necesito una diferencia en días y siempre se sale en segundos. Salvo un ejemplo copiado de un libro, pero yo necesito procesar los datos propios. Les paso el código en R (copiar y pegar, son solo dos días que se comparan) y al final como me salen los resultados porque es medio complicada mi redacción.
¿Alguna idea?
fechas1
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 <-
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 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,
2010 Jun 14
1
Subtracting POSIXct data/times
I have two dataframe columns of POXIXct data/times that include seconds.
I got them into this format using for example
zsort$ETA <- as.POSIXct(as.character(zsort$ETA), format="%m/%d/%Y %H:%M:%S")
My problem is that when I subtract the two columns, sometimes the
difference is given in seconds, and sometimes it is given in minutes. I
don't care which it is, but I need to know which
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
2001 Nov 26
3
Doing things with POSIXt
Dear R-Users,
I have a data file with timestamps and I wanted to use POSIXct time data
type to represent the respective column. I played around with the type and
found a couple of issues:
* there seems to be no direct way of reading datetimes into a variable.
Let's say this is my file
"1992-02-27 23:03:20 PST"
"1992-02-27 22:29:56 PST"
"1992-01-14 01:03:30 PST"
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