[R] DAtes
arun
smartpink111 at yahoo.com
Sat Aug 4 19:03:36 CEST 2012
Hi,
Try this:
tfr<-read.table(text="
14/12/2000 15/12/2000 18/12/2000 19/12/2000 20/12/2000 21/12/2000
22/12/2000 25/12/2000 26/12/2000 27/12/2000 28/12/2000 29/12/2000
01/01/2001 02/01/2001 03/01/2001 04/01/2001 05/01/2001 08/01/2001
09/01/2001 10/01/2001 11/01/2001 12/01/2001 15/01/2001 16/01/2001
17/01/2001 18/01/2001 19/01/2001 22/01/2001 23/01/2001 24/01/2001
25/01/2001 26/01/2001 29/01/2001 30/01/2001 31/01/2001 01/02/2001
02/02/2001 05/02/2001 06/02/2001 07/02/2001 08/02/2001 09/02/2001
12/02/2001 13/02/2001 14/02/2001 15/02/2001 16/02/2001 19/02/2001
20/02/2001 21/02/2001
",sep="",header=FALSE,fill=TRUE,stringsAsFactors=FALSE)
as.Date(tfr$V1,format="%d/%m/%Y")
[1] "2000-12-14" "2000-12-22" "2001-01-01" "2001-01-09" "2001-01-17"
[6] "2001-01-25" "2001-02-02" "2001-02-12" "2001-02-20"
A.K.
----- Original Message -----
From: Trying To learn again <tryingtolearnagain at gmail.com>
To: r-help at r-project.org
Cc:
Sent: Saturday, August 4, 2012 12:09 PM
Subject: [R] DAtes
Hi all,
I´m trying to convert as a data frame (with format "date") this copied
excel column of dates (exposed below), I have tried to save them in a txt
file
tfr<-read.table("tfra.txt")
tfr<-data.frame(tfr)
I have tried several things, as date, so on, but always error.
And it makes
Error en as.Date.default(tfr, "%m/%d/%y") :
do not know how to convert 'a' to class "Date"
Can anyone give me a clue or a gide to achieve this final result.
14/12/2000 15/12/2000 18/12/2000 19/12/2000 20/12/2000 21/12/2000
22/12/2000 25/12/2000 26/12/2000 27/12/2000 28/12/2000 29/12/2000
01/01/2001 02/01/2001 03/01/2001 04/01/2001 05/01/2001 08/01/2001
09/01/2001 10/01/2001 11/01/2001 12/01/2001 15/01/2001 16/01/2001
17/01/2001 18/01/2001 19/01/2001 22/01/2001 23/01/2001 24/01/2001
25/01/2001 26/01/2001 29/01/2001 30/01/2001 31/01/2001 01/02/2001
02/02/2001 05/02/2001 06/02/2001 07/02/2001 08/02/2001 09/02/2001
12/02/2001 13/02/2001 14/02/2001 15/02/2001 16/02/2001 19/02/2001
20/02/2001 21/02/2001
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list