日期格式%B%Y的转换 [英] Conversion of date format %B %Y
本文介绍了日期格式%B%Y的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们能以某种方式将诸如"2017年11月","2017年12月"
之类的日期转换为日期吗?我尝试导入csv数据,但收到了因子列.
Can we somehow convert dates such as "November 2017", "December 2017"
to date? I tried to import csv data, but received factor columns.
我尝试了以下代码,但没有成功.
I tried the following code, but was not successful.
as.POSIXct(as.character(dat$Date), format = "%B %Y")
推荐答案
来自 lubridate
包
dmy(paste("01", dat$Date))
这篇关于日期格式%B%Y的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文