Hi, Try this: str1<-c("01OCT1928","02OCT1928","03OCT1928","04OCT1928") strptime(str1,"%d%b%Y") [1] "1928-10-01" "1928-10-02" "1928-10-03" "1928-10-04"
#or you can use this: x<-as.Date(str1,format="%d%b%Y") x [1] "1928-10-01" "1928-10-02" "1928-10-03" "1928-10-04" A.K. ----- Original Message ----- From: Data Analytics Corp. <w...@dataanalyticscorp.com> To: r-help@r-project.org Cc: Sent: Tuesday, June 19, 2012 8:00 AM Subject: [R] Date formats Hi, I imported an excel table (using read.csv) of Dow Jones monthly average closings where the first variable is a date as a character string such as "01OCT1928". How do I convert this to a date variable so I can plot monthly average closings against date using ggplot2? Thanks, Walt ________________________ Walter R. Paczkowski, Ph.D. Data Analytics Corp. 44 Hamilton Lane Plainsboro, NJ 08536 ________________________ (V) 609-936-8999 (F) 609-936-3733 w...@dataanalyticscorp.com www.dataanalyticscorp.com ______________________________________________ R-help@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. ______________________________________________ R-help@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.