Displaying 20 results from an estimated 7000 matches similar to: "Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?"
2012 Jul 30
1
Possible bug in class 'POSIXlt' when including microseconds?
Dear list,
I'm a bit puzzled by an ambiguity with respect to the representation of
micro-/milliseconds when using 'POSIXlt' objects.
It seems that the last digit of the 'sec' attribute sometimes seems to
differ from the digits shown when printing the 'POSIXlt' object. You'll
find a little SO post with some example code here:
2008 Feb 04
1
strftime fails on POSIXct objects (PR#10695)
R 2.6.1 on a Thinkpad T60 running up-to-date Gentoo:
Despite the documentation, which says:
'strftime' is an alias for 'format.POSIXlt', and 'format.POSIXct'
first converts to class '"POSIXlt"' by calling 'as.POSIXlt'. Note
that only that conversion depends on the time zone.
strftime fails on POSIXct objects:
> foo <-
2008 May 08
2
Microseconds for a zoo object?
Hello
I have a string which contains microseconds, can anyone help on
constructing this in to a time object, with the microseconds, that I can
take to a ZOO file?
Thanks
Sean
> UK[1,3]
[1] "17:09:53.824"
> UK[1,1]
[1] "2007-12-11 00:00:00"
> mydates <- paste( substr(UK[,1], 1, 10), UK[,3])
> mydates[1]
[1] "2007-12-11 17:09:53.824"
>
2024 Nov 25
1
Alternative to some recently changed parts of dates.R and datetime.R
In?function?'Summary.Date'?in?dates.R?,
..1
could?be?used?instead?of
...elt(1L)
In?function?'format.POSIXlt'?in?datetime.R?,
unlist(unclass(x)[1L:3L],?use.names=FALSE)
could?be?used?instead?of
unlist(`names<-`(unclass(x)[1L:3L],?NULL))
Also, the fragment
secs <- x$sec[f0]; secs <- secs[is.finite(secs)]
could be put inside
if(np?>=?1L)
2012 Mar 06
3
Label rows of table by factor level for groups of factors
Dear useRs,
I am sure this is a fairly simple problem, but I just cannot get my head around it.
I have a dataframe which contains several factor variables. I can use table() to tell me how many different combinations there are of these variables. What I should like to do is to add a column to my original dataframe which labels each row according to the unique combination of factors.
E.g. in
2019 Mar 09
0
POSIXlt$zone and $gmtoff questions
I've been searching for patterns in why some POSIXlt objects have the zone
and gmtoff components and some don't and why gmtoff is sometimes NA when
the zone is known. Is there a pattern or is it just that the additional
fields and workarounds were added in an ad hoc way?
E.g., as.POSIXlt adds the zone and gmtoff components for all strings and
logical NA inputs if the time zone is not
2005 Mar 29
0
setAs between a new S4 class and "POSIXlt"
Dear R core team
Please apologize for posting the same question twice on R-help and
R-devel. Since I was not sure which list is appropriate I tried R-help (Tue
Mar 22), but got no answer.
Now I do not know if the formulation of my question was unclear or the
question is not so easy to answer or to easy (what I do not hope).
My problem: I create a new S4 class, containing one slot, data (of
2016 Dec 06
0
segfault with POSIXlt zone=NULL zone=""
On Tue, Dec 6, 2016 at 6:37 AM, <frederik at ofb.net> wrote:
> Hi all,
>
> I ran into a segfault while playing with dates.
>
> $ R --no-init-file
> ...
> > library(lubridate); d=as.POSIXlt(floor_date(Sys.time(),"year")); d$zone=NULL; d$zone=""; d
>
If you're asking about a bug in R, you should provide a *minimal*
reproducible
2020 Oct 23
0
The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?
?Hi again,
I take advantage of my previous mail to ask you a question for which I was looking for an answer when detected the behaviour I previously told. In the help of DataTimeClasses one can read:
"POSIXlt" objects will often have an attribute "tzone", a character vector of length 3 giving the time zone name from the TZ environment variable and the names of the base time
2007 Feb 16
0
Request: make as.POSIXlt generic
In the base package, as.POSIXct() is an S3 generic function, but
as.POSIXlt() is not. As shown below, the current implementation is
already crying out to be refactored into a generic function with methods
for various classes. It calls "inherits" five times. Not only is this
bad style, it also disallows me or anyone else from making as.POSIXlt()
work with other kinds of time-ish
2005 Mar 22
0
setAs between a new S4 class and "POSIXlt"
Dear R gurus
I've a question concerning the transformation of a new S4 class
(that I defined) and the existing class "POSIXlt". I did the
following:
## Definition of the new class:
setClass("dtime",
representation(data = "POSIXlt"),
prototype(data = as.POSIXlt("2004/06/01")))
## Transformation between the new class "dtime"
2016 Dec 06
1
segfault with POSIXlt zone=NULL zone=""
>>>>> Joshua Ulrich <josh.m.ulrich at gmail.com>
>>>>> on Tue, 6 Dec 2016 09:51:16 -0600 writes:
> On Tue, Dec 6, 2016 at 6:37 AM, <frederik at ofb.net> wrote:
>> Hi all,
>>
>> I ran into a segfault while playing with dates.
>>
>> $ R --no-init-file
>> ...
>> >
2016 Dec 06
1
segfault with POSIXlt zone=NULL zone=""
Hi Joshua,
Thank you for minimizing my test case.
> > Hope I'm not doing something illegal...
> >
> You are. You're changing the internal structure of a POSIXlt object
> by re-ordering the list elements. You should not expect a malformed
> POSIXlt object to behave as if it's correctly formed. You can see
> it's malformed by comparing it's
2010 Jul 14
1
POSIXlt error for 1982-01-01
Hi, I am encountering a strange error in POSIXlt... anyone got a clue?
> as.POSIXlt("1982-01-01")
Error in as.POSIXlt.character("1982-01-01") :
character string is not in a standard unambiguous format
> as.POSIXlt("1992-01-01")
[1] "1992-01-01"
> as.POSIXlt("1972-01-01")
[1] "1972-01-01"
> as.POSIXlt("1962-01-01")
2010 Jul 14
1
POSIXlt error
Hi, I'm encountering a strange error in POSIXlt... anyone got a clue on
this?
> as.POSIXlt("1982-01-01")
Error in as.POSIXlt.character("1982-01-01") :
character string is not in a standard unambiguous format
> as.POSIXlt("1992-01-01")
[1] "1992-01-01"
> as.POSIXlt("1972-01-01")
[1] "1972-01-01"
>
2003 Aug 04
0
as.POSIXct Bug when used with POSIXlt arg and tz= arg (PR#3646)
Tracking down this bug was joint work with Jermoe Asselin (jerome at
hivnet.ubc.ca) and Patrick Connolly (p.connolly at hortresearch.co.nz). We
collectively were able to determine that this is a problem in both Windows 2000
and in Linux and by testing it in our three time zones that it seems to be
daylight savings time related.
Conversion of POSIXlt datetimes to POSIXct appears to have problems.
2008 Feb 17
1
How to make a vector/list/array of POSIXlt object?
Hi Guys,
I'm cooking up my time series code. I want a data frame with first column as timestamp in POSIXlt format.
I hit on this the problem of how to create an array/list/vector of POSIXlt objects. Code is as follows
> dtt=array(dim = 2)
> t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> dtt
[1] NA NA
> t
[1]
2011 Aug 07
1
all.equal doesn't work for POSIXlt objects
Hi all,
following sample code illustrates the problem :
Date1 <- Date2 <-
as.POSIXlt(seq.Date(as.Date("2010-04-01"),as.Date("2011-04-01"),by='day'))
identical(Date1,Date2)
all.equal(Date1,Date2)
identical() gives the correct answer. As there is no all.equal method
for POSIXlt objects, all.equal.list is used instead. Subsetting using
[[]] doesn't work
2012 Sep 05
2
POSIXlt and daylight savings time
I have a data frame that contains dates, but when I use as.POSIXlt() I lose
the hours on all records. I traced this down to a particuar hour which
causes the issue...
> as.POSIXlt('2004-10-31 02:00:00')
[1] "2004-10-31"
> as.POSIXlt('2004-10-31 03:00:00')
[1] "2004-10-31 03:00:00"
How do I tell as.POSIXlt() to ignore daylight savings and just convert to
2002 Mar 25
2
Extreme value distributions (Long.)
This may not actually be an R/Splus problem, but it started
off that way .....
===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
Executive summary:
==================
Simulations involving extreme value distributions seem to ``work''
when the underlying distribution is exponential(1) or exponential(2)
== chi-squared_2, but NOT when the underlying distribution is