提取日期的奇怪格式(欧元/mm/yyyy)
我想从R的格式转换为Mmyyy的格式。 怪兽柱具有特征。
structure(list(Monat = c("EURO MTH/07/2015", "EURO MTH/08/2015",
"EURO MTH/09/2015", "EURO MTH/10/2015", "EURO MTH/11/2015", "EURO MTH/12/2015"
), Gesamtpreis = c(145667346.4375, 138659005.976562, 152031299.125,
127354805.953125, 141803880.734375, 146695055.171875)), row.names = c(NA,
6L), class = "data.frame")
谢谢。
I want to convert the date in the format MMYYYY from a column which is in this format EURO MTH/MM/YYYY in R.
The Monat column is in character.
structure(list(Monat = c("EURO MTH/07/2015", "EURO MTH/08/2015",
"EURO MTH/09/2015", "EURO MTH/10/2015", "EURO MTH/11/2015", "EURO MTH/12/2015"
), Gesamtpreis = c(145667346.4375, 138659005.976562, 152031299.125,
127354805.953125, 141803880.734375, 146695055.171875)), row.names = c(NA,
6L), class = "data.frame")
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一种方法,但没有包裹
lubridate
,基本r就足够了。由
Here is a way but not with package
lubridate
, base R is enough.Created on 2022-07-03 by the reprex package (v2.0.1)
这是
lubridate
,gsub
和strftime
的方法。Here's a way with
lubridate
,gsub
andstrftime
.这是使用
Stringr
软件包和REGEX的另一个选项:Here is another option using
stringr
package and regex: