我想将具有以下格式的日期列转换21 Septiembre 2019
为21/09/2019
我使用过的格式,parse_date_time
但是我一直收到错误消息。
我正在使用的代码
这是包含日期的对象 STM_silla_2$date
STM_silla_2$date <- parse_date_time(x=STM_silla_2$date, orders = c("dBY", "dBy"))
```
我收到以下错误。可能是因为包裹无法识别西班牙语月份吗?
All formats failed to parse. No formats found
这是一些数据样本
dput(STM_silla_2$date[1:5])
c(" 26 Septiembre 2016 ", " 06 Septiembre 2012 ", " 25 Octubre 2013 ", " 07 Septiembre 2015"," 19 Noviembre 2014 ")
我也试图dmy()
从:lubridate
没有结果。
将您的语言环境设置为西班牙语,然后转换为 Date
Sys.setlocale("LC_ALL","es_ES")
as.Date("21 Septiembre 2019", "%d %B %Y")
#[1] "2019-09-21"
在那之后也lubridate::dmy
可以
lubridate::dmy("21 Septiembre 2019")
#[1] "2019-09-21"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句