[英]Getting week number from a date format
My dataframe has a date vector which in the format of :2/14/2003, 11/30/2007, 10/18/2002. 我的数据框有一个日期向量,其格式为:2/14 / 2003、11 / 30 / 2007、10 / 18/2002。
Doing a print command gives me numbers: 执行打印命令会给我一些数字:
> print (c(movieDB$releaseDate[1:5]))
[1] 461 304 130 495 858
How do I extract week numbers from this data? 如何从此数据中提取周数?
Thanks Sinha 谢谢辛哈
Put your dates into date format and then use the lubridate
package: 将日期放入日期格式,然后使用
lubridate
软件包:
library(lubridate)
d <- as.Date("11/30/2007", format="%m/%d/%Y")
d
week(d)
#48
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.