Re: [R] Extract month and year as one column

2015-03-13 Thread Gabor Grothendieck
On Fri, Mar 13, 2015 at 11:36 AM, Kumsaa waddee...@gmail.com wrote: How could I extract both month and year from a date? I know how to separately extract both using lubridate package: df$month - month(df$date) df$year- year(df$date) I wish to extract year and month as one column

[R] Extract month and year as one column

2015-03-13 Thread Kumsaa
How could I extract both month and year from a date? I know how to separately extract both using lubridate package: df$month - month(df$date) df$year- year(df$date) I wish to extract year and month as one column dput(mydf) structure(list(date = structure(c(14975, 14976, 14977, 14978, 14979,

Re: [R] Extract month and year as one column

2015-03-13 Thread David Winsemius
On Mar 13, 2015, at 8:36 AM, Kumsaa wrote: How could I extract both month and year from a date? I know how to separately extract both using lubridate package: df$month - month(df$date) df$year- year(df$date) Use format.Date: # and see ?strptime for more format specifications.