I had started thinking of writing my own class...this is much nicer. Thanks!
Josh On Fri, Sep 17, 2010 at 12:27 PM, Henrique Dallazuanna <www...@gmail.com> wrote: > > Try this: > > library(zoo) > as.yearmon(x, "%Y-%B") > > > On Fri, Sep 17, 2010 at 4:23 PM, Joshua Wiley <jwiley.ps...@gmail.com> > wrote: >> >> Hi all, >> >> Is there a built in or easier way to work with dates that are *just* >> Year-Month? >> Right now I paste() on a day as a work around, but it ultimately needs to >> be >> in Year-Month form, so then I use format() to get rid of the day. >> >> x <- c("2006-December", "2006-July") >> x <- paste(x, "-01", sep='') >> x <- as.Date(x, "%Y-%B-%d") >> x <- sort(x) >> x <- format(x, format = "%Y-%B") >> > x >> [1] "2006-July" "2006-December" >> >> Thanks, >> >> Josh >> >> >> -- >> Joshua Wiley >> Ph.D. Student, Health Psychology >> University of California, Los Angeles >> http://www.joshuawiley.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. > > > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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.