Displaying 20 results from an estimated 30000 matches similar to: "Odd behaviour of as.POSIXct"
2011 Sep 23
1
Building R on Windows 7 -- No rule to make target `etc/GETDESC', needed by `fixetc'.
Hi all,
I have been experiencing difficulties building R (be this 2.13.1,
beta, devel, or rc) on Windows 7 64bit.
I believe I am following the manual religiously, and don't think I am
doing anything differently from the many successful build attempts in
the past. Unzipping the tarball works fine, but when I invoke make, I
get (shown for R-rc, same for 2-13.1):
2011 Aug 08
1
aggregate.zoo on bivariate data
Hi,
I'm removing non-unique time indices in a zoo time series by means of
aggregate. The time series is bivariate, and the row to be kept only depends
on the maximum of one of the two columns. Here's an example:
x <- zoo(rbind( c(1,1), c(1.1, 0.9), c(1.1, 1.1), c(1,1) ),
order.by=c(1,1,2,2))
The eventual aggregated result should be
1 1.1 0.9
2 1.1 1.1
that is, in
2017 Mar 09
1
as.POSIXct behaviour
Dear R-devel, I have tested the code below on R v3.3.2 and v3.3.3 on
Mac and Windows.
x <- c("2017-01-01 05:00:02", "2017-01-02 03 :M:00") # note the ? :M?
in 2nd value
as.POSIXct(x)
# [1] "2017-01-01 GMT" "2017-01-02 GMT?
The time info is lost on the first index as well. And it happens *silently*.
On the other hand, if I do:
lapply(x, as.POSIXct)
#?[[1]]
2008 Feb 05
1
Inconsistent lattice scales$x$at,label behaviour for POSIXct
I have encountered the following behaviour in lattice in 2.6.1 (and
2.4.0) which differs depending upon the type you use. I believe the
numeric behaviour to be correct, and the POSIXct behaviour to be in
error.
When the x data and x axis in a lattice graph are POSIXct, and when
using scales$x$at and scales$x$labels to add custom labels:
If the first visible at value is not the first
2010 Nov 12
1
unexpected behaviour of rbind with dataframe containing POSIXct
Hello list,
here is what I stumbled upon:
1> test <- data.frame(time=as.POSIXct((1:2),origin="2000-1-1"))
1> test
time
1 2000-01-01 00:00:01
2 2000-01-01 00:00:02
1> rbind(test,b=1:2)
Fehler in as.POSIXct.numeric(value) : 'origin' muss angegeben werden
When I try to attach an additional row to a dataframe with a row
containing dates I get the
2006 Oct 04
2
integers to POSIXct
What is the recommended way to convert/coerce and integer to a POSIXct
please?
d <- as.POSIXct(Sys.Date())
i <- as.integer(d)
as.POSIXct(i)
Error in as.POSIXct.default(i) : do not know how to convert 'i' to class
"POSIXlt"
This appears to be the behaviour in 2.3.1 and 2.4.0 on windows XP.
I have tried searching on this and found as.Date.integer in package zoo
which
2006 Jun 06
3
Suspicious behaviour of sort on POSIXct vectors in R-2.3.0 and R-2.3.1
Hi ,
When I sort a vector of POSIXct values in R-2.3.0 and R-2.3.1, I get a
vector of numeric values and this gets some of my code to crash (class
object creation). Is that a R bug?
In the mean time. I'll try to override the sort function for the POSIXct
objects.
Thanks,
Patrick Gu?vel
Head of quantitative research for electronic trading
This message and any attachments (the
2006 Jun 06
3
Suspicious behaviour of sort on POSIXct vectors in R-2.3.0 and R-2.3.1
Hi ,
When I sort a vector of POSIXct values in R-2.3.0 and R-2.3.1, I get a
vector of numeric values and this gets some of my code to crash (class
object creation). Is that a R bug?
In the mean time. I'll try to override the sort function for the POSIXct
objects.
Thanks,
Patrick Gu?vel
Head of quantitative research for electronic trading
This message and any attachments (the
2012 Mar 25
2
Weird POSIXct behaviour
Friends
I have an xts that I wish to access.
Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"]
bid
2012-03-20 00:59:57 1.4993
So far so good.
Now putting the index into a variable:
Browse[2]> Time
[1] "2012-03-20 00:59:57 NZDT"
Browse[2]> DATA.ba[[p]][Time, "bid"]
bid
Where has it gone?
Looking closer....
2008 May 26
2
Strange behaviour of as.POSIXct
Hi:
I do not understand the returned value of NA in the following, which is a simplified version of
my attempt to convert the start column of the data frame AirQual in the SwissAir package.
as.POSIXct(paste('04.04.2004 0',0:3,sep=''),format='%d.%m.%Y %H')
[1] "2004-04-04 00:00:00 EST" "2004-04-04 01:00:00 EST"
[3] NA
2011 Mar 24
5
subset and as.POSIXct / as.POSIXlt oddness
Dear R users,
Given this data:
x <- seq(1,100,1)
dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00")
dfx <- data.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 >
2008 Jan 27
1
bug in difftime with as.POSIXct
I am trying to do ephemeris calculations in R, which involves calculating an
elapsed time. As illustrated below, difftime seems to have problems with my
method, since the fractional day is sometimes the correct 0.5 and sometimes
the incorrect 0.46.
I am doing this on with R-2.6.1 on a powerpc-apple-darwin8.10.1 system.
I get the same results for as.POSIXlt() instead of as.POSIXct(), but the
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 annoying DST
timezone).
This came up on
2013 Jan 11
1
Date time conversion bug (as.POSIXct)?
There is something wrong, I think, with the date-time conversion from a
numeric value if you use Central European Time (CET) as timezone.
Examples from R:
If I use the GMT time zone it is OK, I get the same time back from
as.POSIXct as I entered
> as.POSIXct(as.numeric(strptime("30/01/2012 13:00:00", format="%d/%m/%Y
>
2009 Jul 20
1
Problem with as.POSIXct on dates object
Dear R-helpers,
I have a problem converting an object made with the 'chron' function
to a POSIXct object:
# Make date based on DOY
dat <- chron(dates=232, origin.=c(month=1, day=1, year=2008))
dat
#[1] 08/20/08
# Converting to POSIXct uses current timezone (Sydney):
as.POSIXct(dat)
#[1] "2008-08-20 10:00:00 EST"
# Setting GMT timezone has no effect?
as.POSIXct(dat,
2005 Oct 17
1
as.POSIXct before and after 1970
Can someone, please, explain the difference in as.POSIXct results
before 1970 and on and after 1970 as illustrated below.
After 1970, the use of 'EST' or "EST+5EDT' as the timezone does not
affect the result of asPOSIXct, but before 1970 on 10/28 the results
are different.
> as.POSIXct('1970-10-29', tz='EST')+1
[1] "1970-10-29 00:00:01 EST"
>
2012 Jul 19
1
as.POSIXct questions
The following three calls all produce the same result (my machine is in EST):
> as.POSIXct(0, tz="", origin=ISOdatetime(1970,1,1,10,0,0))
[1] "1970-01-01 10:00:00 EST"
> as.POSIXct(0, tz="EST", origin=ISOdatetime(1970,1,1,10,0,0))
[1] "1970-01-01 10:00:00 EST"
> as.POSIXct(0, tz="GMT", origin=ISOdatetime(1970,1,1,10,0,0))
[1]
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"
>
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)
2011 Aug 24
1
as.numeric() and POSIXct format
Hi!
I'm confused by this:
> as.numeric(as.POSIXct(518400,origin="2001-01-01"))
[1] 978822000
I guess the problem is that as.numeric() assumes a different origin, but cannot find
any default origin.
How can I get back the seconds from the POSIXct format? In other words, which
the inverse function of as.POSIXct()?
I've tried as.numeric and unclass() using a origin=