Displaying 20 results from an estimated 20000 matches similar to: "POSIX formats have problems with NA (PR#1732)"
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 <-
2010 Feb 01
1
Error with cut.POSIXt and daylight savings time switchover dates
The following code:
cut(as.POSIXct("2009-11-01 04:00:00", tz="America/Los_Angeles"), "1 day")
gives the error:
Error in seq.int(0, to - from, by) : 'to' must be finite
This is related to November 1st, 2009 being the switchover date from daylight savings time to standard time in the America/Los_Angeles time zone.  In particular, in cut.POSIXt, the starting
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
2002 May 21
1
I() fails on objects of class POSIXct (PR#1587)
Although the documentation is somewhat sketchy, I() can be used to create
objects of class AsIs:
> I("a")
[1] "a"
attr(,"class")
[1] "AsIs"      "character"
> I(4)
[1] 4
attr(,"class")
[1] "AsIs"    "numeric"
> I(4 + 0i)
[1] 4+0i
attr(,"class")
[1] "AsIs"    "complex"
> 
This
2004 May 24
1
as.matrix.data.frame() in R 1.9.0 converts to character when it should (?) convert to numeric
Conversion of a data frame to a matrix using as.matrix() when a 
column of the data frame is POSIXt and all other columns are numeric 
has changed in R 1.9.0 from R 1.8.1. The new behavior issues a 
warning message and converts to a character matrix. In R 1.8.1, such 
an object was converted to a numeric matrix.
Here is an example.
#### R 1.9.0 ####
>  foo <- data.frame(
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
2020 Oct 01
3
timezone tests and R-devel
The return value of Sys.time() today with a timezone of US/Eastern is
unchanged between 4.0.3-patched and devel, but on devel the following test
fails
  all.equal(x, as.POSIXlt(x))
with
  x = Sys.time()
This means that devel does not complete make tests (failure on
tests/reg-tests-2.R)
It is entirely possible that it is an error on my end, I use
  export TZ="US/Eastern"
but I have been
2012 Aug 24
1
POSIXct-coerced NA's not considered NA by is.na()
Hello folks,
I found a strangeness while experimenting with POSIXct vectors and
lists.  It seems that coerced NA's aren't "real" NAs, at least as
considered by is.na()?
> date_vec = c(as.POSIXct(now()), as.POSIXct(now()+1),NA,"b")
> date_vec
[1] "2012-08-22 15:00:46 COT" "2012-08-22 15:00:47 COT" NA
[4] NA
Warning message:
In
2017 May 17
2
R-3.4.0 fails test
After installing R-3.4.0 I ran 'make check'  which halted here:
$ > tail reg-tests-1d.Rout.fail -n 16
> ## format()ing invalid hand-constructed  POSIXlt  objects
> d <- as.POSIXlt("2016-12-06"); d$zone <- 1
> tools::assertError(format(d))
> d$zone <- NULL
> stopifnot(identical(format(d),"2016-12-06"))
> d$zone <- "CET" # =
2017 May 17
2
R-3.4.0 fails test
After installing R-3.4.0 I ran 'make check'  which halted here:
$ > tail reg-tests-1d.Rout.fail -n 16
> ## format()ing invalid hand-constructed  POSIXlt  objects
> d <- as.POSIXlt("2016-12-06"); d$zone <- 1
> tools::assertError(format(d))
> d$zone <- NULL
> stopifnot(identical(format(d),"2016-12-06"))
> d$zone <- "CET" # =
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers,
I have encountered a strange problem using diff() and POSIXt:
dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006")
dts <- strptime(dts, "%d/%m/%Y")
class(dts)
[1] "POSIXt" 
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers,
I have encountered a strange problem using diff() and POSIXt:
dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006")
dts <- strptime(dts, "%d/%m/%Y")
class(dts)
[1] "POSIXt" 
2005 Nov 10
4
write.table read.table with Dates
I've found several similar issues with write.table/read.table
with Dates on this list, but trying to follow this advice I still
get an error.
First, I read in data from several files, constructing several date/time
columns using ISOdatetime
> str(Tall$Begin)
'POSIXct', format: chr [1:40114] "2005-10-02 00:00:00" "2005-10-02
00:00:00" ...
> length(Tall$Begin)
2009 Nov 12
1
xts conversion problem
I have two data frames, with two columns each, the first being a Date
variable. I would like to convert them to xts objects, indexed by the
Date column. I would like to use as.Date and not as.POSIXct as the
dateformat. The puzzling fact is that it works for the first one but
not the other. Here is a screenshot of the error:
> str(DF1)
'data.frame':   367 obs. of  2 variables:
 $
2020 Oct 02
2
timezone tests and R-devel
Yes, the potential issue I see is that
  make check
fails when I explicitly set TZ. However, I set it to be the same as what
the system reports when I login.
Details: The system (RHEL) I am working on has
$ strings /etc/localtime | tail -n 1
EST5EDT,M3.2.0,M11.1.0
$ date +%Z
EDT
$ echo $TZ
US/Eastern
On Fri, Oct 2, 2020 at 9:48 AM Sebastian Meyer <seb.meyer at fau.de> wrote:
> Thank
2007 Jan 04
3
problem with plot() and POSIXt dates
Hy all,
 
I'm plotting graphs using plot() function, they are on X axes POSIX dates:
 "POSIXt"   "oldClass" "POSIXct"  "POSIXlt"
I can't figure out why sometimes it prints the month and days and sometimes it prints the unix timestamp.
It appens usually when the xlim is short like only some days.
xlim is settled as a POSIXt like this
"2006-12-30
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
2006 Mar 06
1
Length of a vector of POSIX objects reported incorrectly?
I have a vector of POSIX times/dates (called "times")  that I want to  
plot.  But I'm having trouble because R reports the length of the  
vector incorrectly.  Can someone help me figure out what's going on  
here?
This code....
print(times)
print(class(times))
print(length(times))
Produces this...
.
.
.
[355] "2006-03-06 18:34:00" "2006-03-06 18:32:00"