[R] Creating dates to plot
arun
smartpink111 at yahoo.com
Fri Nov 16 13:50:50 CET 2012
HI,
How about this?
library(zoo)
Period<-c("201206","201207","201208")
as.yearmon(Period,format="%Y%m")
#[1] "Jun 2012" "Jul 2012" "Aug 2012"
A.K.
----- Original Message -----
From: PtitBleu <ptit_bleu at yahoo.fr>
To: r-help at r-project.org
Cc:
Sent: Friday, November 16, 2012 2:56 AM
Subject: Re: [R] Creating dates to plot
Hello Eric,
strptime("201206",format="%Y%m") gives NA (I don't know why but I'm a
newbie).
The only solution I found is to add "01" as a day to have a complete date
(Year Month Day):
x$Period<-as.Date(paste(x$Period,"01",sep=""),format="%Y%m%d")
Then you get a Date format you can use to plot graph.
I think you will get better solutions from advanced users.
Have a good day,
Ptit Bleu.
--
View this message in context: http://r.789695.n4.nabble.com/Creating-dates-to-plot-tp4649695p4649704.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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