similar to: as.POSIXct problem?

Displaying 20 results from an estimated 10000 matches similar to: "as.POSIXct problem?"

2010 Sep 03
1
Incorrect formatted output after subtracting non-integer seconds from POSIXt origin
> x<-as.POSIXct("1970-1-1", tz="UTC")-.5 > y<-as.POSIXct("1970-1-1", tz="UTC")+.5 > x==y [1] FALSE # of course but x and y "appear" to be the same when formatted, even with extra precision: > format(x, format="%Y-%m-%d %H:%M:%OS2") [1] "1970-01-01 00:00:00.50" > format(y, format="%Y-%m-%d
2007 Jan 17
2
problem with unlist POSIX date at midnight
Dear R-users, I use unlist of POSIX dates to extract the year, hour etc. With that I can search for files in my database which are in the form 'yyyymmddhh_synops.txt' However, I get stucked during midnight where unlist just gives NA's. The script is given below, the problem accurs at acc.period[16] (midnight). However when I write out the character, unlist works well. But
2004 May 06
3
strptime
Delving into the murky world of dates and times I found this: dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") > times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26") > x <- paste(dates, times) > z <- strptime(x, "%m/%d/%y
2005 Feb 10
3
question about sorting POSIXt vector
Dear useRs, How come the first attempt to sort a POSIXt vector fails (Error: non-atomic type in greater), while the second succeeds? (Code inserted below.) The documentation says that POSIXt is used to allow operations such as subtraction, so I'd expect sorting to work. Is this perhaps an OS issue? (I run R 2.0.1 on Win xp.) Thank you, b. #------------code test <- c("2005-02-08
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 Jun 22
2
strange date problem - May 3, 1992 is NA
> is.na(strptime("5/2/1992", format="%m/%d/%Y")) [1] FALSE > is.na(strptime("5/3/1992", format="%m/%d/%Y")) [1] TRUE Any idea what's going on with this? Running strptime against all dates from around 1946, only 5/3/1992 was converted as "NA". Even stranger, it still seems to have a value associated with it (even though is.na thinks
2010 Oct 01
3
Converting a dataframe column from string to datetime
Hi, I have a dataframe column of the form v<-c("Fri Feb 05 20:00:01.43000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:06.34000 2010") I need to convert this to datetime form. I did the following.. lapply(v,function(x){strptime(x, "%a %b %d %H:%M:%OS %Y")}) This gives me a list that looks like
2007 Jul 17
1
problem with length()
In the following, can anyone tell me why length(eee) returns 9? I was expecting 15398, and when I try to add this vector to a data frame with that many rows, it fails complaining that the vector is of length 9. In what I thought was an identical situation with a related dataset, the same code worked as expected. > length(fff) [1] 15398 > str(fff) int [1:15398] 20010102 20010102
2003 Aug 13
1
Problems with addition in big POSIX dates
Have you noticed any problems with big dates (>=1/1/2040) in R? Here is the bit of code that I'm having trouble with: > test.date <- strptime("1/1/2040",format="%m/%d/%Y") > > unlist(test.date) sec min hour mday mon year wday yday isdst 0 0 0 1 0 140 0 0 0 > > date.plus.one <- as.POSIXct(test.date) +
2004 Apr 23
4
is.na(valid_date) too often true on SGI MIPS (PR#6814)
Full_Name: George N. White III Version: 1.9.0 OS: Irix 6.5.21m Submission from: (NULL) (142.176.61.212) R-1.9.0 built using the SGI MIPSPro compilers Installation directory: /usr/local C compiler: c99 -OPT:IEEE_NaN_inf=ON -mips4 -n32 -O3 -OPT:Olimit_opt=on C++ compiler: CC -OPT:IEEE_NaN_inf=ON -mips4 -n32 -O3 -OPT:Olimit_opt=on -LANG:std Fortran compiler:
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
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 <-
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 : > >
2004 Feb 06
2
vector of factors to POSIXlt
hello, I have a vector of factors > str(rcptdt) Factor w/ 51 levels "1/10/03","1/13/03",..: > length(rcptdt) [1] 87 which i want to convert to class POSIXlt to extract the day, so: a1<-format(rcptdt,"%m/%d/%y") > length(a1) [1] 87 and: a2<-strptime(a1, "%m/%d/%y") str(a2) `POSIXlt', format: chr [1:87] "2002-04-18"
2009 Nov 19
6
Surprising length() of POSIXlt vector (PR#14073)
Arrays of POSIXlt dates always return a length of 9. This is correct (they're really lists of vectors of seconds, hours, and so forth), but other methods disguise them as flat vectors, giving superficially surprising behaviour: strings <- paste('2009-1-', 1:31, sep='') dates <- strptime(strings, format="%Y-%m-%d") print(dates) # [1]
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
2004 Aug 17
3
Fwd: strptime() problem?
Hi all; I've already send a similar e-mail to the list and Prof. Brian Ripley answered me but my doubts remain unresolved. Thanks for the clarification, but perhaps I wasn't clear enough in posting my questions. I've got a postgres database which I read into R. The first column is Timestamp with timezone, and my data are already in UTC format. An 'printed' extract of R
2006 Oct 27
2
POSIXct time zone and daylight savings issues
Hello, Suppose we need a function that takes a POSIXct object and need to calculate the time difference between it and GMT time: gmtDiff <- function(time) { time.gmt <- as.POSIXct(format(time, tz="GMT")) time.plt <- as.POSIXlt(time) dlstime <- ifelse(time.plt$isdst > 0, 1, 0) timezone <- as.numeric(difftime(time, time.gmt, units="hours"))
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
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