; "2011-01-04" "2011-01-04"
> as.Date(as.character(dat1),"%m/%d/$Y")
[1] NA NA NA
A.K.
- Original Message -
From: Erin Hodgess
To: R help
Cc:
Sent: Tuesday, June 26, 2012 11:54 PM
Subject: [R] question about formatting Dates
Dear R People:
I have date
1/06/2011"
[6] "01/07/2011" "01/08/2011" "01/09/2011" "01/10/2011"
--
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
> -Original Message--
Hello,
I'm afraid you're wrong, this has nothing to do with leading zeros. Just
see:
x <- c("1/2/2011", "1/4/2011", "1/4/2011", "1/4/2011", "1/6/2011",
"1/7/2011",
"1/8/2011", "1/9/2011", "1/10/2011")
as.Date(x, "%m/%d/%Y")
y <- factor(x)
str(y)
as.Date(as.character(y), "%m/%d
On Tue, 26-Jun-2012 at 10:54PM -0500, Erin Hodgess wrote:
|> Dear R People:
|>
|> I have dates as factors in the following:
|>
|> > poudel.df$DATE
|> [1] 1/2/2011 1/4/2011 1/4/2011 1/4/2011 1/6/2011 1/7/2011 1/8/2011
|> [8] 1/9/2011 1/10/2011
|> Levels: 1/10/2011 1/2/2011 1/4/2011 1/6/201
On Tue, Jun 26, 2012 at 10:54 PM, Erin Hodgess wrote:
> Dear R People:
>
> I have dates as factors in the following:
>
>> poudel.df$DATE
> [1] 1/2/2011 1/4/2011 1/4/2011 1/4/2011 1/6/2011 1/7/2011 1/8/2011
> [8] 1/9/2011 1/10/2011
> Levels: 1/10/2011 1/2/2011 1/4/2011 1/6/2011 1/7/2011 1/8/
Dear R People:
I have dates as factors in the following:
> poudel.df$DATE
[1] 1/2/2011 1/4/2011 1/4/2011 1/4/2011 1/6/2011 1/7/2011 1/8/2011
[8] 1/9/2011 1/10/2011
Levels: 1/10/2011 1/2/2011 1/4/2011 1/6/2011 1/7/2011 1/8/2011 1/9/2011
>
I want them to be "regular" dates which can be sort
6 matches
Mail list logo