search for: posixct

Displaying 20 results from an estimated 1357 matches for "posixct".

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 > as.integer(as.POSIXct("2004-04-03") - as.POSIXct("2004-02-27")) [1] 36 > as.integer(as.POSIXct("2004-04-04") - as.POSIXct("2004-02-27")) [1] 37 > as.integer(as.POSIXct("2004-...
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(...
2004 May 19
2
POSIX to ts and back to POSIX
I am trying to use POSIX datetime objects rather than chron datetime objects but am having difficulty with POSIX in a time series. My question: Once a POSIXct vector is bound to a time series, is there a function to convert back to POSIXct? The following code demonstrates what I am trying to do. > ts(as.POSIXct(strptime(tmp,"%m/%d/%Y %H:%M:%S")),freq=1440) Time Series: Start = c(1, 1) End = c(1, 10) Frequency = 1440 [1] 1074022572 1074022...
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...
2023 Oct 16
1
creating a time series
Why did you expect to have 177647 elements ? I found that 177642 is the correct number: Marc baslangic <- as.POSIXct("2017-11-02 13:30:00", tz = "CET") bitis <- as.POSIXct("2022-11-26 23:45:00", tz = "CET")? # zaman_seti <- seq.POSIXt(from = baslangic, to = bitis, by = 60 * 15) y2017_11_02 <- seq(from=as.POSIXct("2017-11-02 13:30:00", tz = "CET&quot...
2008 Jul 15
1
code reduction (if anyone feels like it)
...1.890929, 33.317914), nrow=1) RM148 <- matrix(c(-81.7547337, 33.1514072), nrow=1) RM119 <- matrix(c(-81.501919, 32.94038), nrow=1) RM61 <- matrix(c(-81.262388, 32.524739), nrow=1) RM215.sp <- SpatialPoints(RM215, proj4string=CRS("+proj=longlat +datum=WGS84")) d060101 <- as.POSIXct("2006-01-01", tz="EST") study_seq <- seq(from=d060101, length.out=761, by="days") up.215 <- sunriset(RM215.sp, study_seq, direction="sunrise", POSIXct.out=TRUE) down.215 <- sunriset(RM215.sp, study_seq, direction="sunset", POSIXct.out=TRUE)...
2012 Jan 19
2
POSIXct value display incorrect for some values
First, the reproducable example, showing how converting from character to POSIXct to character changes the milliseconds in the first time stamp though not in the second: > as.POSIXct('2010-06-03 9:03:58.324') [1] "2010-06-03 09:03:58.323 PDT" > as.POSIXct('2010-06-03 9:03:58.325') [1] "2010-06-03 09:03:58.325 PDT" This seems to be du...
2023 Oct 16
1
Ynt: creating a time series
...elp <r-help-bounces at r-project.org> G?nderildi: 16 Ekim 2023 Pazartesi 13:43 Kime: r-help at r-project.org <r-help at r-project.org> Konu: Re: [R] creating a time series Why did you expect to have 177647 elements ? I found that 177642 is the correct number: Marc baslangic <- as.POSIXct("2017-11-02 13:30:00", tz = "CET") bitis <- as.POSIXct("2022-11-26 23:45:00", tz = "CET") # zaman_seti <- seq.POSIXt(from = baslangic, to = bitis, by = 60 * 15) y2017_11_02 <- seq(from=as.POSIXct("2017-11-02 13:30:00", tz = "CET&quot...
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(), "GMT") + NA > > is.na(x) [1] TRUE > is.na(y) [1] TRUE > > x <- NA > class(x) <- c(&q...
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" > 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 res...
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 War...
2003 Sep 02
1
convert character to POSIXct
Dear list-members, I would like to calculate the difference between two points in time. To convert a 'time (GMT)'-character with the format "1/1/1999 01:01:01" into an object of class "POSIXct"', I first use the strptime() as suggested in the details help(as.POSIXct). e.g. starttime<-strptime("1/1/1999 01:01:01",format="%d/%m/%Y %H:%M:%S") endtime<-strptime("1/8/1999 01:01:01",format="%d/%m/%Y %H:%M:%S") > starttime [1] "1999...
2003 Aug 04
0
as.POSIXct Bug when used with POSIXlt arg and tz= arg (PR#3646)
...t 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. Consider the following where lt1 and lt2 are both POSIXlt dates that correspond to the same date even though they were created using different statements. Even though lt1 and lt2 represent the same date, as.POSIXct(lt1,tz="") and as.POSIXct(lt2,tz="")...
2003 Jan 22
1
Convert numeric value to POSIXct
Hi, How do I convert a numeric value indicating the time since 1970, back into a POSIXct class object? I have tried format.POSIXct and as.POSIXct without success. For example > ccc [1] "1945-01-01 15:00:00 MDT" > ddd<- as.numeric(ccc); > ddd [1] -788842800 > format.POSIXct(ddd) Error in format.POSIXct(ddd) : wrong class > as.POSIXct(ddd) Error in as.POSIXc...
2003 Jun 05
1
question about POSIXct conversion
...1054814100 1054791000 78 1054822200 1054790400 843 1054807200 1054795800 864 1054813800 1054790700 92 1054789500 1054790100 940 1054800600 1054795800 971 1054783800 1054796700 where time1 is POSIXct object. str(mt) tells me, that mt has mode 'numeric' NOT POSIXct When i am trying to set: mode(mt)<-'POSIXct' i get a message: Don't know how to convert `structure(c(1054800600, 1054804500, ' to class "POSIXct" When i am trying to do: mode(mt)<-'char...
2019 Jan 05
1
unsorted - suggestion for performance improvement and ALTREP support for POSIXct
...en_t n, i; n = XLENGTH(x); double* real_x = REAL(x); for(i = 0; i+1 < n ; i++) if(real_x[i] > real_x[i+1]) return ScalarLogical(TRUE); return ScalarLogical(FALSE);"; f2 = inline::cfunction(sig = signature(x='numeric'), body=body) # unsorted x.double = as.double(1:1e7) + 0 x.posixct = Sys.time() + x.double microbenchmark::microbenchmark( f1(x.double), f2(x.double), # faster due to one REAL() f1(x.posixct), f2(x.posixct), # faster due to one REAL() unit='ms', times=10) Unit: milliseconds expr min lq mean median uq ma...
2004 Mar 05
3
as.POSIXct problem
Hi all, I'm having difficulty converting a 'dates' object to a POSIXct object: testDATES<-c(35947,35971,36004,36008,36053,36066) testDATES<-chron(dates=testDATES, format = c(dates = "m/d/y"), origin=c(month = 12, day = 30, year = 1899)) >[1] 06/01/98 06/25/98 07/28/98 08/01/98 09/15/98 09/28/98 > as.POSIXct(testDATES) [1] NA NA NA NA NA NA...
2011 May 31
3
DateTime Math in R - POSIXct
Greetings - I'm battling POSIXct, as per the code below. My input is actually an XL file, but the weird results below correctly model what I am seeing in my program. Before I punt and use lubridate or timeDate, could anyone please help me understand why POSIXct forces my variable back to GMT? I suspect that I'm not pr...
2018 May 16
2
Date method of as.POSIXct does not respect tz
R 3.5.0 Is it intended that the Date method of as.POSIXct does not respect the tz parameter? I suggest changing as.POSIXct.Date to this: function (x, tz = "", ...) .POSIXct(unclass(x) * 86400, tz = tz) Currently, the best workaround seems to be using the character method if one doesn't want the default timezone (which is often an anno...
2023 Oct 16
2
creating a time series
Hello everyone, ? had 15 minutes of data from 2017-11-02 13:30:00 to 2022-11-26 23:45:00 and number of data is 177647 ? would like to ask why my time series are less then my expectation. baslangic <- as.POSIXct("2017-11-02 13:30:00", tz = "CET") bitis <- as.POSIXct("2022-11-26 23:45:00", tz = "CET") # zaman_seti <- seq.POSIXt(from = baslangic, to = bitis, by = 60 * 15) length(zaman_seti) [1] 177642 but it has to be 177647 and secondly ? have times in t...