Displaying 20 results from an estimated 30000 matches similar to: "POSIXlt and trunc"
2024 Feb 08
1
round.Date and trunc.Date not working / implemented
Technically, there is a round() for 'Date' objects, but it doesn't
seem very useful, because it basically just fall back to the default
round() method, which only takes the 'digits' argument.
Here's an example:
> date <- Sys.Date()
> class(date)
[1] "Date"
We see that there are only two round() methods in addition to the
implicit built-in one;
>
2024 Feb 08
1
round.Date and trunc.Date not working / implemented
?s 14:36 de 08/02/2024, Olivier Benz via R-devel escreveu:
>> On 8 Feb 2024, at 15:15, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>>
>>>>>>> Ji?? Moravec
>>>>>>> on Wed, 7 Feb 2024 10:23:15 +1300 writes:
>>
>>> This is my first time working with dates, so if the answer is "Duh, work
>>> with
2002 May 12
0
{round,trunc}.POSIXt and daylight savings time (PR#1543)
I have found what looks like a small problem in trunc.POSIXt()
involving the transition to/from standard time and daylight savings
time. Assuming my assessment is correct, I have a potential solution
to offer.
If a time in daylight savings time is rounded such that the rounded
value is on the other side of the transition, the isdst element does
not get changed accordingly. I have tested only
2024 Feb 08
1
round.Date and trunc.Date not working / implemented
This is a workaround, and could be the basis for a round.Date improvement:
date <- Sys.Date()
as.Date(round(as.POSIXct(date), "years"))
as.Date(round(as.POSIXct(Sys.Date() + 180), "years"))
Duncan Murdoch
On 08/02/2024 12:23 p.m., Henrik Bengtsson wrote:
> Technically, there is a round() for 'Date' objects, but it doesn't
> seem very useful,
2010 Feb 01
1
Error with cut.POSIXt and daylight savings time switchover dates
The following code:
cut(as.POSIXct("2009-11-01 04:00:00", tz="America/Los_Angeles"), "1 day")
gives the error:
Error in seq.int(0, to - from, by) : 'to' must be finite
This is related to November 1st, 2009 being the switchover date from daylight savings time to standard time in the America/Los_Angeles time zone. In particular, in cut.POSIXt, the starting
2024 Feb 08
2
round.Date and trunc.Date not working / implemented
>>>>> Ji?? Moravec
>>>>> on Wed, 7 Feb 2024 10:23:15 +1300 writes:
> This is my first time working with dates, so if the answer is "Duh, work
> with POSIXt", please ignore it.
> Why is not `round.Date` and `trunc.Date` "implemented" for `Date`?
> Is this because `Date` is (mostly) a virtual class setup for a
2024 Feb 08
2
round.Date and trunc.Date not working / implemented
> On 8 Feb 2024, at 15:15, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
>>>>>> Ji?? Moravec
>>>>>> on Wed, 7 Feb 2024 10:23:15 +1300 writes:
>
>> This is my first time working with dates, so if the answer is "Duh, work
>> with POSIXt", please ignore it.
>
>> Why is not `round.Date` and
2011 Jan 30
4
Extract time only from POSIXlt object
How can I extract only the time component from an POSIXlt object?
For example if I try the following it still returns both the date and
time...
>as.POSIXlt(tr.date[1])
[1] "2010-10-18 21:46:53"
>as.POSIXlt(tr.date[1],"%H:%M:%S")
[1] "2010-10-18 21:46:53"
round and trunc don't help... is there an "as.Time" equivalent to as.Date
?
Thanks,
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]
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
2024 Feb 06
1
round.Date and trunc.Date not working / implemented
This is my first time working with dates, so if the answer is "Duh, work
with POSIXt", please ignore it.
Why is not `round.Date` and `trunc.Date` "implemented" for `Date`?
Is this because `Date` is (mostly) a virtual class setup for a better
inheritance or is that something that is just missing? (like
`sort.data.frame`). Would R core welcome a patch?
I decided to convert
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]
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers,
I have encountered a strange problem using diff() and POSIXt:
dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006")
dts <- strptime(dts, "%d/%m/%Y")
class(dts)
[1] "POSIXt"
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers,
I have encountered a strange problem using diff() and POSIXt:
dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006")
dts <- strptime(dts, "%d/%m/%Y")
class(dts)
[1] "POSIXt"
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",
2011 Mar 08
1
Date arithmetic coerces POSIXlt to POSIXct?
Hi. This feels like a bug to me, or at least an undocumented feature,
but I thought I'd see what people here thought of it. Consider a POSIXlt
object like this one:
> a <- as.POSIXlt ("2011-01-23 12:45:45")
> class (a)
[1] "POSIXlt" "POSIXt"
Fine. Now, if I do some arithmetic on that object, the result is
converted to POSIXct.
> class (a
2011 Feb 18
1
problem with rbind when data frame contains an date-time variable "POSIXt" "POSIXlt"
I'm trying to rbind two data frames, both with the same columns names. One
of the columns is a variable with date-time and this variable is causing the
rbind to fail--giving the error
"Error in names(value[[jj]])[ri] <- nm : 'names' attribute [7568] must be
the same length as the vector [9]"
Is there a way to stack or rbind these two data frames even with this
extended
2011 Mar 23
0
suggestions re trunc.POSIXt
Dear all,
I hope this is a right place to post this; r-help might be appropriate
but it looks like I'm suggesting a change in base package, so I
decided to post here. (+ Apologies if that has been changed recently
-- the version I'm using is R.2.12.2 on Windows.)
I've noticed an unexpected behavior of trunc.POSIXt:
foo <- seq(as.POSIXct( "2009-10-23 22:00:00"),
2012 Feb 24
6
strange behaviour of "POSIXlt" "POSIXt" object
Hi,
Does anybody know why get I this kind of strange situation:
Browse[2]> hcEnd
[1] "2009-03-29 06:30:00"
Browse[2]> class(hcEnd)
[1] "POSIXlt" "POSIXt"
Browse[2]> is.na(hcEnd)
[1] TRUE
This issue is the source of my all issues in my program,
Thanks for your help
--
View this message in context:
2003 Jan 22
1
text() does not accept data of type POSIXlt (PR#2487)
[R 1.6.1]
PROBLEM
If text() is called with an argument of type POSIXlt,
I get the following error message:
"Error in as.double.default(x) :
(list) object cannot be coerced to vector type 14"
REMARK
plot() accepts this data.
EXAMPLE
data( Lifeboats, package='vcd' )
attach(Lifeboats)
plot( launch, total )
text( launch, total,