Displaying 20 results from an estimated 10000 matches similar to: "'as.Date' conversion of classes POSIX*t (problem/feature)?"
2006 Sep 01
3
Date conversion with as.POSIXct and as.POSIXlt (PR#9196)
Full_Name: Erich Neuwirth
Version: 2.3.1
OS: Windows XP, Linux
Submission from: (NULL) (131.130.135.167)
Converting Sys.Date() to a POSIX compliant time type in different ways
produces inconsistent results:
> Sys.date()
[1] "2006-09-01"
> as.POSIXct(Sys.Date())
[1] "2006-09-01 02:00:00 CEST"
> as.POSIXlt(Sys.Date())
[1] "2006-09-01"
>
2002 Jul 02
1
POSIX formats have problems with NA (PR#1732)
# pure replication code at end
> # These work
>
> Sys.time() + NA
[1] NA
> as.POSIXlt(Sys.time(), "GMT") + NA
[1] NA
>
> class(Sys.time() + NA)
[1] "POSIXt" "POSIXct"
> class(as.POSIXlt(Sys.time(), "GMT") + NA)
[1] "POSIXt" "POSIXct"
>
> x <- Sys.time() + NA
> y <- as.POSIXlt(Sys.time(),
2003 Aug 30
2
Bug in plot() with POSIX dates (PR#4024)
When I do this (highly simplified example):
plot(as.POSIXct(c("1984-01-01","1984-01-02")), c(1,2), col=2)
I get a partially red (col=2) x-axis between and including the first and last tick marks.
Otherwise ok. Only happens with POSIXct or POSIXlt dates.
Also, POSIX dates cannot be used on the y-axis?
POSIXlt gives an error, and POSIXct is unformatted.
Bruce
Using X11
2009 Mar 04
2
patch for axis.POSIXct (related to timezones)
I am finding that axis.POSIXct uses the local timezone for deciding where to
put tic marks, even if the data being plotted are in another time zone. The
solution is to use attr() to copy from the 'x' (provided as an argument) to
the 'z' (used for the 'at' locations).
I have pasted my proposed solution in section 1 below (as a diff). Then, in
section 2, I'll put some
2012 Jun 15
2
time zones and the chron to POSIXct conversion
Hey R folks,
i found some strange (to me) behaviour with chron to POSIXct conversion.
The two lines of code result in two different results, on ewith the
correct time zone, one without:
library(chron)
as.POSIXct(chron('12/12/2000'), tz = 'UTC')
as.POSIXlt(chron('12/12/2000'), tz = 'UTC')
Only the code below would give me a POSIXct object with the correct time
2004 Oct 28
2
POSIX time anomaly (PR#7317)
Full_Name: Allen McIntosh
Version: 2.0.0
OS: RedHat 9.0
Submission from: (NULL) (67.80.175.118)
The POSIX time printing routine gives strange results when asked to print a time
that is exactly midnight:
TZ=CST6CDT R -q --no-save
> strptime("10/5/2004 00:00:01 CDT", "%m/%d/%Y %H:%M:%S %Z")
[1] "2004-10-05 00:00:01"
> strptime("10/5/2004 00:00:00
2009 Mar 15
1
Conversion and rounding of POSIXct
POSIXct/lt supports fractional seconds (see Sub-second Accuracy
section of man page), but there seem to be some inconsistencies in
their handling.
Converting to POSIXlt and back does not give back the same time for
times before the origin:
> t0 <- as.POSIXct('1934-01-05 23:59:59.00001')
> t0
[1] "1934-01-06 00:00:00 EST" # rounding issue, see below
>
2003 Feb 21
1
POSIX problem in New Zealand (PR#2570)
Full_Name: Arni Magnusson
Version: 1.6.2
OS: Windows XP
Submission from: (NULL) (210.48.49.68)
Hi there. I'm experiencing unexpected behaviour from as.POSIXct:
> as.POSIXct("1969-12-24")
[1] "1969-12-23 23:00:00 New Zealand Standard Time"
> as.POSIXlt("1969-12-24")
[1] "1969-12-24"
> as.POSIXlt("1969-12-24")+1
[1] "1969-12-23
2012 Jul 13
1
read mignight as 24:00 and not as 0:00
Dear all,
I have dataset which contains date and time in the format
"yearmonthdayhour". I can read in these data correctly as follows:
mydata <- read.csv("pm10_corine_gridcel_hourly_2011.csv", header = TRUE)
mydata$date <- as.POSIXct(strptime(mydata$date, format = "%Y%m%d%H",
tz="UTC"))
However, midnight is defined as 24:00 in my original file (so
2004 Jul 07
1
question about seq.dates from chron vs. as.POSIXct
Dear R People:
Here is an interesting question:
>library(chron)
>xt <- seq.dates(from="01/01/2004",by="days",length=5)
>xt
[1] 01/01/04 01/02/04 01/03/04 01/04/04 01/05/04
>
#Fine so far
>as.POSIXct(xt)
[1] "2003-12-31 18:00:00 Central Standard Time"
[2] "2004-01-01 18:00:00 Central Standard Time"
[3] "2004-01-02 18:00:00 Central
2003 Mar 23
1
error in POSIX help
Hello, the documentation for POSIXct and POSIXlt
refers to the timezone keyword as "TZ". The functions
expect "tz".
BTW, is this where errors/ bugs should be reported?
Cheers, Mike.
=====
__________________________________________________
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
2002 May 03
1
Daylight savings time and conversion to POSIXt (arghh!)
I have asked this question before, and received some suggestions for
work-arounds that get the job done--and they are much appreciated.
But I would still like to find out if I'm missing something, and
whether there is a direct way using POSIXt functions (as.POSIXct,
as.POSIXlt, strptime, in particular).
I have environmental data collected once per minute. Here is a subset
of 3 input
2006 Nov 09
1
POSIXlt converted to POSIXct in as.data.frame()
In trying to use as.Date(), I've come across the conversion of POSIXlt to
POSIXct when a POSIXlt variable is included in a data frame:
my_POSIX <- strptime(c("11-09-2006", "11-10-2006", "11-11-2006",
"11-12-2006", "11-13-2006"), "%m-%d-%Y")
str(my_POSIX)
my_Date <- as.Date(my_POSIX)
str(my_Date)
data <- format(my_Date)
2008 Apr 10
1
ISOdate/ISOdatetime performance suggestions, other date/time questions
Dear list:
working with date/times I have come across a problem that ISOdate and
ISOdatetime are too slow on large vectors of data. I was surprised just
until I looked at the implementation and the man page: "ISOdatetime and
ISOdate are convenience wrappers for strptime". In other terms, they
convert data to character representation first in order to create a
POSIXlt object that is then
2020 Apr 24
4
Timezone conversion on Ubuntu 20.04
Hi all,
I am testing R 4.0 and ran into an issue with timezones on Ubuntu
Focal: converting a timestamp to another timezone results in NA:
as.POSIXct(as.POSIXlt(Sys.time(), tz = "CET"), tz = "EST")
This only happens on Ubuntu Focal, it seems to work fine on Ubuntu
Bionic. I am the standard ubuntu docker image icw/ r-base from Dirk's
ppa:edd/r-4.0 on both systems.
Am I
2004 Oct 05
2
correct my method of estimating mean of two POSIXlt data frames
Hello, I searched the archives but could not come to a solution. I
have to two columns of information
t_start_cdt looks like:
> t_start_cdt[1:4]
[1] "2003-07-09 11:02:25" "2003-07-09 11:10:25" "2003-07-09 11:30:25"
[4] "2003-07-09 12:00:25"
> class(t_start_cdt)
[1] "POSIXt" "POSIXlt"
t_end_cdt looks like:
> t_end_cdt[1:4]
2012 Nov 05
1
Dates as POSIXt
When I try to do linear interpolation between financial contracts with maturities on different dates in different months I have come across some behavior I haven't seen before.
I have a data frame in R which is loaded from an access database so I can't provide a working example. It was loaded using this code:
> dbPath <- "H:/pathToDB/DB.mdb"
> channel <-
2005 Apr 30
1
segfault during build of 2.1.0 on RH9; print.POSIXct implicated (PR#7827)
In attempting to build R using
rpmbuild --rebuild R-2.1.0-0.fdr.2.fc3.src.rpm
on a fairly up-to-date RedHat 9 system (that is, with patches installed
through May 1 2004), it failed at the make check-all step.
The problem was reproducible by going into the tests directory and
make test-Segfault
The last lines of the saved file no-segfault.Rout.fail are
> > ## c.POSIXct :
> >
2011 Mar 24
5
subset and as.POSIXct / as.POSIXlt oddness
Dear R users,
Given this data:
x <- seq(1,100,1)
dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00")
dfx <- data.frame(dx)
Now to play around for example:
subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00"))
Ok. Now for some reason I want to extract the datapoints between hours
10:00:00 and 14:00:00, so I thought well:
subset(dfx, dx >
2006 Apr 10
3
timeAlign
I use POSIXct for datetimes. Is thee a timeAlign function that I can
use where :
align by year
direction -1 ==> start of this year
direction 1 ==> start of next year
align by week
direction -1 ==> date on last sunday
direction 1 ==> date on next sunday
align by day
direction -1 ==> time at past midnight
direction 1 ==> time at this comming