Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将字符串转换为数字日期格式的问题R_R_Date_Lubridate_Date Conversion - Fatal编程技术网

将字符串转换为数字日期格式的问题R

将字符串转换为数字日期格式的问题R,r,date,lubridate,date-conversion,R,Date,Lubridate,Date Conversion,我想将具有以下格式的日期列21 Septiembre 2019转换为21/09/2019我使用了parse_date_time,但我一直收到一个错误 我正在使用的代码 这是包含日期的对象 STM\u silla\u 2$date Sys.setlocale("LC_ALL","es_ES") as.Date("21 Septiembre 2019", "%d %B %Y") #[1] "2019-09-21" STM_silla_2$date将您的语言环境设置为西班牙语,然后转换为date S

我想将具有以下格式的日期列
21 Septiembre 2019
转换为
21/09/2019
我使用了
parse_date_time
,但我一直收到一个错误

我正在使用的代码

这是包含日期的对象
STM\u silla\u 2$date

Sys.setlocale("LC_ALL","es_ES")
as.Date("21 Septiembre 2019", "%d %B %Y")
#[1] "2019-09-21"

STM_silla_2$date将您的语言环境设置为西班牙语,然后转换为
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"
库(readr)
解析日期(“2016年9月26日”,%d%B%Y,语言环境=语言环境(“es”))

#[1] “2016-09-26”
我在Sys.setlocale(“LC_ALL”,“es_es”)中遇到以下错误
:操作系统报告无法满足将locale设置为“es_es”的请求
@JoseDavid您的操作系统是什么?我的操作系统是windows我没有windows机器来测试这个,但是你能试试
Sys.setlocale(“LC_TIME”,“西班牙语”)