~Onlooker
2012-02-09 17:54
采纳率: 0%
浏览 200

找到一个星期中的某一天

Let's say that I have a date in R and it's formatted as follows.

   date      
2012-02-01 
2012-02-01
2012-02-02

Is there any way in R to add another column with the day of the week associated with the date? The dataset is really large, so it would not make sense to go through manually and make the changes.

df = data.frame(date=c("2012-02-01", "2012-02-01", "2012-02-02")) 

So after adding the days, it would end up looking like:

   date       day
2012-02-01   Wednesday
2012-02-01   Wednesday
2012-02-02   Thursday

Is this possible? Can anyone point me to a package that will allow me to do this? Just trying to automatically generate the day by the date.

转载于:https://stackoverflow.com/questions/9216138/find-the-day-of-a-week

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

7条回答 默认 最新

相关推荐 更多相似问题