Converting day, month, year into week in R?

stephanie
2014-01-21
2014-01-21
  • stephanie
    stephanie
    2014-01-21

    I have dataset with day, month and year. I need to use week.
    How can I converte day, month, year into week in R?

     
  • Dan Hunt
    Dan Hunt
    2014-01-21

    I am assuming you need the week of the year.

    If the values are in a POSIX object you can use strftime() function for C like conversions, e.g., strftime(d, "%W").

    or more generally you can use the format() function, e.g., format(d, "%W").