Displaying 20 results from an estimated 20000 matches similar to: "Length of a vector of POSIX objects reported incorrectly?"
2006 Mar 07
4
POSIX time zone codes
The manual entry for as.POSIX says this about time zone codes...
Usage
as.POSIXct(x, tz = "")
tz
A timezone specification to be used for the conversion...
but it fails to mention what these "specifications" are. So far, I
have tried...
as.POSIX(x, tz="UTC") ... works, gives UTC times
as.POSIX(x, tz="UTC") ... works, gives EST times
as.POSIX(x,
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(),
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]
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
2002 Oct 17
4
Posix Problem, difftime
I am having a series of problems using date time data that has been converted into a POSIXt and POSIXlt classes. I have hourly time series data from 1900 that has been converted from text data.
I assume most of my problems come from a mis-underdanding of the POSIX class. My matrix named (aa) for this year is approx 8700 by 4. When I try to calculate the length of posit column ( which is the
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
2005 Apr 22
2
help with POSIX
For the r script below
>datestr <- "01/01/2004"
>as.POSIXct(as.Date(datestr, "%d/%m/%Y"))
I get the following output
"2003-12-31 18:00:00 Central Standard Time"
Why is the date a day before. I guess its something to do with the time, but is there a way to get it to return 2004-01-01 instead?
Thanks in advance...
-Sandeep
[[alternative HTML version
2004 Oct 05
2
correct my method of estimating mean of two POSIXlt data frames
Hello, I searched the archives but could not come to a solution. I
have to two columns of information
t_start_cdt looks like:
> t_start_cdt[1:4]
[1] "2003-07-09 11:02:25" "2003-07-09 11:10:25" "2003-07-09 11:30:25"
[4] "2003-07-09 12:00:25"
> class(t_start_cdt)
[1] "POSIXt" "POSIXlt"
t_end_cdt looks like:
> t_end_cdt[1:4]
2007 Mar 02
2
Error in length of vector ?
Hi,
I'm having a weird result with the length() function:
>a
[... omited ...]
[9994] NA "2003-12-03 16:37:00" "2002-06-26 18:43:00"
[9997] "2005-07-04 04:00:00" "2007-02-16 22:09:00" "2007-02-24 15:49:00"
[10000] NA
> length(LastModified)
[1] 9
> length(c(LastModified))
[1] 9
I was expecting to get
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
2007 Feb 08
5
remove component from list or data frame
Sorry to ask such a simple question, but I can't find the answer after
extensive searching the docs and the web.
How do you remove a component from a list? For example say you have:
lst<-c(5,6,7,8,9)
How do you remove, for example, the third component in the list?
lst[[3]]]<-NULL generates an error: "Error: more elements supplied
than there are to replace"
Also,
2003 Aug 30
2
Bug in plot() with POSIX dates (PR#4024)
When I do this (highly simplified example):
plot(as.POSIXct(c("1984-01-01","1984-01-02")), c(1,2), col=2)
I get a partially red (col=2) x-axis between and including the first and last tick marks.
Otherwise ok. Only happens with POSIXct or POSIXlt dates.
Also, POSIX dates cannot be used on the y-axis?
POSIXlt gives an error, and POSIXct is unformatted.
Bruce
Using X11
2008 Jul 03
1
'as.Date' conversion of classes POSIX*t (problem/feature)?
Hi,
I'm working with objects of classes "Date","POSIXlt" and "POSIXct" and still
having some Date/Time-related concepts unclear. In the documentation of
"as.Date" one can find:
"The 'as.Date' methods accept ... '"POSIXlt"' and '"POSIXct"'. (The last are
converted to days by ignoring the time after
2012 Nov 05
1
Dates as POSIXt
When I try to do linear interpolation between financial contracts with maturities on different dates in different months I have come across some behavior I haven't seen before.
I have a data frame in R which is loaded from an access database so I can't provide a working example. It was loaded using this code:
> dbPath <- "H:/pathToDB/DB.mdb"
> channel <-
2004 Apr 23
3
time zones in POSIXt
Hi,
I have two data sources. One records time in PST time zone, the other in
GMT. I want to compute the difference between the two, but don't see
how. Here is an example where I compute time difference between
identical times each (meant to be) relative to its time zone.
> as.POSIXlt("2000-05-10 10:15:00", "PST") - as.POSIXlt("2000-05-10
10:15:00",
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 Dec 10
2
converting multiple columns from POSIX* to Date
converting a POSIX class variable to a date class is easy.
dates<-as.Date(x) #where X is of class POSIX
How does one do that to all columns in a data frame that are of POSIX
class and leave all the other columns (integers, factors) as is.
Feel free to reply with just one or two buzzwords that I could then
search for to find how to do it.
Farrel Buchinsky
2011 Feb 14
3
how to order POSIXt objects ?
I have a problem ordering by descending magnitude a POSIXt object. Can
someone help please and let me know how to work around this. My goal is to
be able to order my data by DATE and then by descending TIME.
I have tried to include as much info as possible below. The problem stems
from trying to read in times from a CSV file. I have converted the character
time values to a POSIXt object using the
2024 Oct 10
2
Time zones in POSIClt objects
POSIXt vectors do not support different time zones element-to-element.
If you want to keep track of timezones per element, you have to create a vector of timestamps (I would recommend POSIXct using UTC) and a parallel vector of timezone strings. How you manipulate these depends on your use cases, but from R's perspective you will have to manipulate them element-by-element.
I complained about
2003 May 20
3
plot POSIX class and identify
Hallo all
just a small question I did not find an answer in help pages.
Is it possible to use identify() after plotting with plot.POSIX to
label points and/or to find out some points?
Thanks a lot.
Best regards
Petr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz