Displaying 20 results from an estimated 10000 matches similar to: "as.POSIXct behaviour"
2016 Apr 04
2
Understanding POSIXct creation on different OSes.
Hello,
Following Dirk's post here: https://github.com/Rdatatable/data.table/issues/1619
we would like to clarify if this is the right behaviour, and if so,
the rationale behind it.
Here's the summary (thanks to Dirk and Joshua):
Sys.setenv("TZ"="America/Chicago")
dates = as.Date("2016-03-02") + (0:3)*7 # four Wednesdays
# [1] "2016-03-02"
2015 Jan 08
2
On base::rank
Have a look at the following, taken from base::rank:
...
if (!is.na(na.last) && any(nas)) {
yy <- integer(length(x)) # <~~~~~~~~~
storage.mode(yy) <- storage.mode(y) # <~~~~~~~~
yy <- NA
NAkeep <- (na.last == "keep")
if (NAkeep || na.last) {
yy[!nas] <- y
if (!NAkeep)
yy[nas]
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
2011 Jul 15
2
Odd behaviour of as.POSIXct
Dear all,
how come the first loop in the below fails, but the second performs as
expected?
days <- as.Date( c("2000-01-01", "2000-01-02") )
for(day in days)
{
as.POSIXct(day)
}
for( n in 1:length(days) )
{
show(as.POSIXct(days[n]))
}
Many thanks, Jo
[[alternative HTML version deleted]]
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 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
2018 Aug 29
2
Get Logical processor count correctly whether NUMA is enabled or disabled
Dear Tomas, thank you very much. I installed r-devel r75201 and tested.
The machine with 88 cores has NUMA disabled. It therefore has 2 processor groups with 64 and 24 processors each.
require(parallel)
detectCores()
# [1] 88
This is great!
Then I went on to test with a simple 'foreach()' loop. I started with 64 processors (max limit of 1 processor group). I ran with a simple function
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('2009-08-31'))
Time differences in
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
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")
2003 Jun 05
1
question about POSIXct conversion
Hello!
I am trying to compute minimal time on some data like this:
mt<-tapply(mrsh$time1,list(mrsh$var1,mrsh$var2),min):
a b
145 1054800600 1054789800
340 1054804500 1054794600
349 1054820400 1054792800
55 1054800600 1054789200
57 1054814100 1054791000
78 1054822200 1054790400
843
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
Warning message:
In
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 due to truncation of
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
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 Apr 17
1
Tick mark alignment for POSIXct data
I am using POSIXct objects to store my date/time information. If I am
plotting less that 2 days worth of data, I get the correct tick marks on the
x-axis which is showing the 'day HH:MM' and these line up with the data
points.
If the data spans more than 2 days, the tick marks are now off. In the data
below, I am creating some sample data and plotting the points. I am in the
Eastern
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
>