- Mail Original -
De: Stefan Uhmann stefan.uhm...@googlemail.com
À: r-help@r-project.org
Envoyé: Mardi 29 Septembre 2009 13h15:10 GMT +01:00 Amsterdam / Berlin / Berne
/ Rome / Stockholm / Vienne
Objet: Re: [R] sort dates within a factor
Hi Xavier,
thank you for your suggestion, it's not exactly
Dear List,
I have the following data:
test - data.frame(date =
as.Date(c('2007-01-01','2008-03-24','2003-03-02','2008-05-03','2002-05-23','2001-06-30','2005-12-04')),
nr = c(2000,2000,2000,2001,2002,2003,2003))
test
date nr
1 2007-01-01 2000
2 2008-03-24 2000
3 2003-03-02
] sort dates within a factor
Dear List,
I have the following data:
test - data.frame(date =
as.Date(c('2007-01-01','2008-03-24','2003-03-02','2008-05-03','2002-05-23','2001-06-30','2005-12-04')),
nr = c(2000,2000,2000,2001,2002,2003,2003))
test
date nr
1 2007-01-01 2000
2 2008-03
: Mardi 29 Septembre 2009 11h27:20 GMT +01:00 Amsterdam / Berlin / Berne
/ Rome / Stockholm / Vienne
Objet: [R] sort dates within a factor
Dear List,
I have the following data:
test - data.frame(date =
as.Date(c('2007-01-01','2008-03-24','2003-03-02','2008-05-03','2002-05-23','2001-06-30','2005-12
: Stefan Uhmann stefan.uhm...@googlemail.com
À: r-help@r-project.org
Envoyé: Mardi 29 Septembre 2009 13h15:10 GMT +01:00 Amsterdam / Berlin / Berne
/ Rome / Stockholm / Vienne
Objet: Re: [R] sort dates within a factor
Hi Xavier,
thank you for your suggestion, it's not exactly what I need. However I
On Tue, Sep 29, 2009 at 6:58 AM, xavier.char...@free.fr wrote:
Apologies for the misunderstanding. I can come up with a solution that might
suit your needs:
library(plyr)
out - ddply(test, .(nr), function(x) data.frame(date=x$date,
index=rank(-as.integer(x$date
out[is.na(out$nr) |
6 matches
Mail list logo