R:如何从日期中删除日期? [英] R: How to remove the day from a date?
本文介绍了R:如何从日期中删除日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在df列中有一堆日期,格式如下:dd.mm.yyyy
I have a bunch of dates in a df column in the following format: dd.mm.yyyy
我希望它看起来像这样:01/2020( mm.yyyy)
I want it to look like this: 01/2020 (mm.yyyy)
如何从所有日期中删除日期?
How can I remove the day from all of the dates?
推荐答案
除了 @Greg 的格式
选项使用如下所示的 sub
Besides format
by @Greg, another option is using sub
like below
> sub(".*?/","","13/01/2020")
[1] "01/2020"
这篇关于R:如何从日期中删除日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文