Displaying 20 results from an estimated 11000 matches similar to: "Strange behaviour of as.POSIXct"
2007 Aug 08
2
Error: Cannot Coerce POSIXt to POSIXct when building package
A newbie here - please forgive me if this is a basic question. We have an
in house package built in R 2.2.1 (yes we're a little behind the times at
our firm)and would like to rebuild it using R 2.5.1. However, when I try
and build the package from source, I keep getting this error:
Error in as(slotVal, slotClass, strict = FALSE) :
no method or default for coercing "POSIXt"
2011 Mar 21
1
Help with POSIXct
I rarely work with dates in R, so I know very little about the
POSIXct and POSIXlt classes. I'm importing an excel file into R using
the RODBC package, and am having issues reformatting the dates.
1. The important info:
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
2007 Nov 01
1
daylight saving / time zone issues with as.POSIXlt/as.POSIXct (PR#10392)
Running under Windows XP 64 bit, as.POSIXlt()/as.POSIXct() seem
to think that US time zones (EST5EDT, MST7MDT) switched from daylight
savings back to standard time on Oct 28, 2007, whereas the switch
is actually on Sun Nov 04, 2007.
Examples:
> Sys.timezone()
[1] "Mountain Daylight Time"
> as.POSIXct("2007-10-30 12:38:47")
[1] "2007-10-30 12:38:47 Mountain
2009 Oct 26
3
as.POSIXct month problem
Hi everybody
When I try example of strptime
x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
z <- strptime(x, "%d%b%Y")
The result is;
> z
[1] NA NA NA NA
I have got the same result with complete form of month but not with numeric
form.
Any idea?
[[alternative HTML version deleted]]
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="", origin="1970-01-01")
as.POSIXlt( 1.999998 ,
2010 Oct 08
4
Bug in as.POSIXct regarding AM/PM
Dear All,
I encounted in a problem with as.POSIXct() function.
> as.POSIXct("2009/03/26 01:00:00 AM" , format="%Y/%m/%d %I:%M:%S %p")
[1] NA
> as.POSIXct("2009/03/26 02:00:00 PM" , format="%Y/%m/%d %I:%M:%S %p")
[1] NA
I have tried this in the R version 2.11.1, R version 2.10.1 and R version
2.9.2 . They all does not work. The operation system is
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)
2010 Feb 12
2
Unexpected behaviour of x[i] when i is a matrix, on Windows
Hi,
when running the following on different instances of R (Linux and
Windows), I get different results. The one for Linux seems to be the
intended / documented one. When using numeric indices rather than
characters, Windows seemed to behave as expected.
-----------On Windows--------------
x = matrix(FALSE, nrow=3, ncol=3)
colnames(x) = LETTERS[1:3]
rownames(x) = letters[1:3]
x
# A
2010 Feb 02
1
"strange" behaviour: recognition of decimal numbers by 'which'
It is a strange behaviour in that I did not expect it... but I am sure
there is a simple explanation for it and it'll have to do with the way
numbers are stored in R, but it's caught me by surprise and I don't
find it obvious.
Here's a simplified example reproducing the behaviour I encountered:
I create an empty vector, and I fill it with a sequence of numbers: 0,
0.005,
2008 Sep 23
2
read.table & readLines behaviour?
Hi,
I have been using 'read.table' regularly to read tab-delimited text
files with data. No problem, until now.
Now I have a file that appeared to have read fine, and the data inside
looks correct (structure etc), except I only had 15000+ rows out of
the expected 24000. Using 'readLines' instead, and breaking up the
data by tabs, gives me the expected result.
I do not
2006 May 31
1
Inconsistent behaviour when manipulating a ts object with frequency = 12 or 4
Dear All,
I found the following under R 2.3.0 on WINXP (tested on 2 PCs, I do
not have access to Linux from this PC, sorry ... )
> set.seed(10)
> x <- ts(rnorm(6),frequency=7)
> x
Time Series:
Start = c(1, 1)
End = c(1, 6)
Frequency = 7
[1] 0.01874617 -0.18425254 -1.37133055 -0.59916772 0.29454513 0.38979430
> x[24] <- NA
> x
Time Series:
Start = c(1, 1)
End = c(1, 6)
2012 May 23
2
Expected behaviour of is.unsorted?
Hi,
I've read ?is.unsorted and searched. Have found a few items but nothing
close, yet. Is the following expected?
> is.unsorted(data.frame(1:2))
[1] FALSE
> is.unsorted(data.frame(2:1))
[1] FALSE
> is.unsorted(data.frame(1:2,3:4))
[1] TRUE
> is.unsorted(data.frame(2:1,4:3))
[1] TRUE
IIUC, is.unsorted is intended for atomic vectors only (description of x in
?is.unsorted). Indeed
2002 Feb 28
1
Bug in julian() (PR#1332)
Full_Name: Michael Jacob
Version: 1.4.1
OS: Windows 2000 SP2
Submission from: (NULL) (195.27.237.226)
Hi,
there seems to be a bug in julian():
> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=English_United States.1252"
> julian(Sys.time())
Error in fromchar(x) : character string is not in a
2013 Apr 17
1
POSIXt oddness at end of 1969
A user here noticed the following difference between Linux and Windows versions
of R-2.15.3 (and R-3.0.0, I think) when using times within a second of the end of 1969:
f <- function (sec = -1)
{
x1 <- as.POSIXct(c(2 * sec, sec, 0), origin = "1970-01-01", tz = "UTC")
x2 <- as.POSIXlt(x1)
x3 <- as.POSIXct(x2, origin = "1970-01-01", tz =
2009 Dec 22
1
as.Date function yields inconsistent results (PR#14166)
Full_Name: Mario Luoni
Version: 2.10.0
OS: Windows XP HE SP3
Submission from: (NULL) (217.194.59.134)
This piece of code:
zzz1 <- as.POSIXct("1999-03-18", tz="CET")
zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
zzz1 == zzz2
as.Date(zzz1)
as.Date(zzz2)
yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are
different:
>
2010 Mar 18
1
probable timezone confusion with as.yearmon
It looks like a timezone issue, and it's causing confusion to me at least.
My original data:
gmt <-
c("19880101 0000", "19880101 0100", "19880101 0300", "19880101 0400",
"19880101 0500", "19880101 0600")
These were converted to local dates/times with
akst<-strptime(gmt,format="%Y%m%d %H%M")-(3600*9) # because I want
2007 Sep 11
1
POSIXct dates on x-axis using xyplot
I am using 'xyplot' in lattice to plot some data where the x-axis is a
POSIXct date. I have data which spans a 6 month period, but when I
plot it, only the last month is printed on the right hand side of the
axis. I would have expected that at least I would have a beginning
and an ending point so that I have a point of reference as to the time
that the data spans. Here is some test
2008 May 14
1
Time differences (as.difftime?) issue
Dear all,
I have a vector generated using the function strptime:
> my.dt
[1] "2004-04-19 08:35:00 W. Europe Daylight Time" "2004-04-19 09:35:00 W.
Europe Daylight Time" "2004-04-19 11:35:00 W. Europe Daylight Time"
[4] "2004-04-19 13:35:00 W. Europe Daylight Time" "2004-04-20 07:50:00 W.
Europe Daylight Time"
> class(my.dt)
[1]
2013 Jan 28
1
Suggestions for 'diff.default'
I have suggestions for function 'diff.default' in R.
Suggestion 1: If the input is matrix, always return matrix, even if empty.
What happens in R 2.15.2:
> rbind(1:2) # matrix
[,1] [,2]
[1,] 1 2
> diff(rbind(1:2)) # not matrix
integer(0)
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United
1999 Jan 17
1
Other core dumps, with apologies
Norm Josephy <NJOSEPHY@bentley.edu> writes:
> Sir:
>
> I hope you do not mind me sending e-mail directly to you
> rather than to the developer's list. I wish to avoid
> unnecessary traffic on the list when the issue I raise may
> have already been fixed.
As a matter of principle: I *do* mind. One of the purposes of having a
list is that not everyone has the time