This is completely wrong: min _is_ defined for date-times:
min(.leap.seconds)
[1] "1972-07-01 01:00:00 BST"
Please do study the posting guide and do your homework before posting: you
seem unaware of what the POSIXct class is, so ?DateTimeClasses is one
place you need to start. And
method
min does work for POSIXct and Date too:
> ct <- ISOdatetime(2008, 1, 1:10, 0, 0, 0)
> min(ct)
[1] "2008-01-01 EST"
> min(as.Date(ct))
[1] "2008-01-01"
On Mon, Sep 8, 2008 at 6:57 PM, Adam D. I. Kramer
<[EMAIL PROTECTED]> wrote:
> Hi Erich,
>
> Since min() is defined for numbers and not dates,
Hi Erich,
Since min() is defined for numbers and not dates, the problem is in the
min() function. min() is converting from date format to number format.
Your best bet is to make this conversion explicit...such that it is
reversable. So, convert the date into UTC, then UTC to seconds since epoch,
> I would be glad, if someone knew a more elegant way to extract the rows with
> minimum/earliest date per subject.
>
>
> Erich
>
>
> -Ursprüngliche Nachricht-
> Von: jim holtman [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 8. September 2008 14:24
> A
ataframes.
Erich
-Ursprüngliche Nachricht-
Von: Dr Eberhard Lisse [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 8. September 2008 15:43
An: Erich Studerus
Cc: r-help@r-project.org
Betreff: Re: [R] How to preserve date format while aggregating
Erich,
how does the data look, when it comes
dataframes.
Erich
-Ursprüngliche Nachricht-
Von: Dr Eberhard Lisse [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 8. September 2008 15:43
An: Erich Studerus
Cc: r-help@r-project.org
Betreff: Re: [R] How to preserve date format while aggregating
Erich,
how does the data look, when it comes f
ows with
> minimum/earliest date per subject.
>
>
> Erich
>
>
> -Ursprüngliche Nachricht-
> Von: jim holtman [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 8. September 2008 14:24
> An: Erich Studerus
> Cc: r-help@r-project.org
> Betreff: Re: [R] How to
t;.
> I would be glad, if someone knew a more elegant way to extract the rows with
> minimum/earliest date per subject.
>
>
> Erich
>
>
> -Ursprüngliche Nachricht-
> Von: jim holtman [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 8. September 2008 14:24
> An:
re elegant way to extract the rows with
minimum/earliest date per subject.
Erich
-Ursprüngliche Nachricht-
Von: jim holtman [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 8. September 2008 14:24
An: Erich Studerus
Cc: r-help@r-project.org
Betreff: Re: [R] How to preserve date form
Try changing the 'class' of the numeric result back to Date:
> x <- as.Date('2008-09-08')
> x
[1] "2008-09-08"
> y <- as.numeric(x)
> y
[1] 14130
> str(y)
num 14130
> class(y) <- "Date"
> y
[1] "2008-09-08"
> str(y)
Class 'Date' num 14130
>
On Mon, Sep 8, 2008 at 6:38 AM, Erich Studerus
<[EMAI
Hi
I have a dataframe in which some subjects appear in more than one row. I
want to extract the subject-rows which have the minimum date per subject. I
tried the following aggregate function.
attach(dataframe.xy)
aggregate(Date,list(SubjectID),min)
Unfortunately, the format of the Date-column c
11 matches
Mail list logo