且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将因子转换为日期格式?

更新时间:2022-06-15 10:23:18

你已经接近了.format= 需要添加到 as.Date 调用中:

You were close. format= needs to be added to the as.Date call:

mydate <- factor("1/15/2006 0:00:00")
as.Date(mydate, format = "%m/%d/%Y")
## [1] "2006-01-15"