Combining year and month and maintaining order

42 views
Skip to first unread message

Sam Albers

unread,
Jul 29, 2015, 1:52:07 PM7/29/15
to lubridate
Hi there,

If there a way using lubridate to combine year and month while maintaining the nice order that comes with month. Right I am doing this:

#Extract the year
year(c("2014-08-01","2015-07-29","2014-11-01"))

#But then month only preserves the ordering on months ignoring the year
month(c("2014-08-01","2015-07-29","2014-11-01"), label=TRUE, abbr=TRUE)

#Attempting something with paste doesn't yield a sensible solution either.
factor(paste(month(c("2014-08-01","2015-07-29","2014-11-01"), label=TRUE, abbr=TRUE), year(c("2014-08-01","2015-07-29","2014-11-01")), sep=" "))

Any ideas on how I might incorporate year into an ordered extracted date object?

Thanks!

Sam
Reply all
Reply to author
Forward
0 new messages