search for: posixlt

Displaying 20 results from an estimated 696 matches for "posixlt".

Did you mean: posixct
2004 Jun 14
4
Quirks with system.time and simulations
I tried the code that Richard O'Keefe posted last week, to wit: library(chron) ymd.to.POSIXlt <- function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d))) n <- 100000 y <- sample(1970:2004, n, replace=TRUE) m <- sample(1:12, n, replace=TRUE) d <- sample(1:28, n, replace=TRUE) system.time(ymd.to.POSIXlt(y, m, d)) [1] 8.78 0.10 31.7...
2016 Dec 06
1
segfault with POSIXlt zone=NULL zone=""
...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 >> ... >> > 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 example (i.e. one without any package dependencies). > This has nothing to do with lubridate, so yo...
2016 Dec 06
6
segfault with POSIXlt zone=NULL zone=""
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 Attaching package: ?lubridate? The following object is masked from ?package:base?: date Warning message: package ?lubridate? was built under R version 3.4.0 *** caught segfault *** a...
2011 Feb 04
2
terribly annoying bug with POSIXlt : one o'clock is midnight?
Apparently, as.POSIXlt takes one o'clock as the start of the day : > as.POSIXlt(0,origin="1970-01-01") [1] "1970-01-01 01:00:00 CET" > as.POSIXlt(0,origin="1970-01-01 00:00:00") [1] "1970-01-01 01:00:00 CET" > as.POSIXlt(0,origin="1970-01-01 23:59:59") [1] &...
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 using this for a while, and R-4.0.3-patched built today passes make tests....
2006 Sep 01
3
Date conversion with as.POSIXct and as.POSIXlt (PR#9196)
...ion: 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" > as.POSIXct(as.POSIXlt(Sys.Date())) [1] "2006-09-01 01:00:00 CEST" Applying as.POSIXct directly or first applying as.POSIXlt and then applying as.POSIXct produces different results. This happens on Linux with timezone "CEST" > Sys....
2020 Oct 23
2
The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?
Dear all, I have just detected what seems a minor inconsistence with data types. If one unlists a POSIXlt time with GMT zone gets a numeric vector, since the POSIXlt list has no `zone` element, while if one unlists a POSIXlt time with a non GMT zone (also non specifying tz if the Sys.timezone is not GMT) gets a character vector due to including the `zone` element. > x <- as.POSIXlt(Sys.time(), &...
2011 Mar 24
5
subset and as.POSIXct / as.POSIXlt oddness
...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 > as.POSIXct("2007-06-01 16:00:00"), 14 > as.POSIXlt(dx)$hour & as.POSIXlt(dx)$hour < 10) Error in as.POSIXlt.numeric(dx) : 'origin' must be supplied Well that did not work. But why does the following work? 14 > as.POSIXlt(dx)$hour & as.POSIXlt(dx)$hour < 10 Is there something I miss about subset()? Or is there even anothe...
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 unclass()'d output. > > d <- as.POSIXlt(Sys.time()) > unclass(d) # valid POSIX...
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 day...
2011 Jan 30
4
Extract time only from POSIXlt object
How can I extract only the time component from an POSIXlt object? For example if I try the following it still returns both the date and time... >as.POSIXlt(tr.date[1]) [1] "2010-10-18 21:46:53" >as.POSIXlt(tr.date[1],"%H:%M:%S") [1] "2010-10-18 21:46:53" round and trunc don't help... is there an "as.Time&qu...
2012 Jun 15
2
POSIXlt and trunc
Hi, I'm having trouble understanding how trunc is operating on vectors of POSIXlt objects. Why does dates[1:4] in the last line return a bunch of NAs even though dates look like it has all the right elements? This worries me that something is off with my use of trunc. Is trunc not suppose to be vectorized with POSIXlt? If not, then how should I truncate a bunch of POSIXlt object...
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...
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...
2013 Apr 24
1
Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?
Dear list, When using as.POSIXlt with times measured down to microseconds the default format.POSIXlt seems to cause some possibly undesirable behaviour: According to the code in format.POSIXlt the maximum accuracy of printing fractional seconds is 1 microsecond, but if I do; options( digits.secs = 6 ) as.POSIXlt( 1.000002 , tz=&...
2005 Mar 29
0
setAs between a new S4 class and "POSIXlt"
...t 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 class POSIXlt). I tried to define a transformation via setAs() between the new S4 class and the existing "POSIXlt" class that is virtual S4 Class with subclass "POSIXt". Then using as() gives an error message (see code below) when I transform from "POSIXlt" to t...
2009 Jan 28
2
length of POSIXlt object (PR#13482)
The length() of a POSIXlt object is given as 9 regardless of the actual length. For example: > make.date.time function (year=c(2006,2006),month=c(8,8),day=2:5,hour=13,minute=45) {# convert year, etc., into POSIXlt object # d=as.character(make.date(year,month,day)) t=paste(hour,minute,sep=":") as.POSIXlt(paste(...
2012 Feb 24
6
strange behaviour of "POSIXlt" "POSIXt" object
Hi, Does anybody know why get I this kind of strange situation: Browse[2]> hcEnd [1] "2009-03-29 06:30:00" Browse[2]> class(hcEnd) [1] "POSIXlt" "POSIXt" Browse[2]> is.na(hcEnd) [1] TRUE This issue is the source of my all issues in my program, Thanks for your help -- View this message in context: http://r.789695.n4.nabble.com/strange-behaviour-of-POSIXlt-POSIXt-object-tp4418115p4418115.html Sent from the R help maili...
2004 Oct 05
2
correct my method of estimating mean of two POSIXlt data frames
...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] [1] "2003-07-09 11:02:35" "2003-07-09 11:10:35" "2003-07-09 11:30:35" [4] "2003-07-09 12:00:35" > class(t_end_cdt) [1] "POSIXt" "POSIXlt" I'd like to estimate the mean of each &quo...
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] &q...