r两位数分为四年
以最简单的方式添加当前一年的列(只有最后两位数字21、22、23),以包括前两个数字(在这种情况下,只有“ 20”)。我尝试过str_glue和past0(“ 20”,可变),但没有运气。任何功能/帮助都将不胜感激。另外,当前年份的列是字符类型,而不是当前的日期。
test&lt; - tibble(rep =“ John Smith”,四分之一=“ Q2”,年= 19:23,Ideal_year = 2019:2023)%&gt;%突变(年= as.Character(Year))< /代码>
Stumped on easiest way to append a current year column (only has last two digits 21, 22, 23) to include first two digits (in this case only "20"). I've tried str_glue and past0("20", variable) but had no luck. Any functions/help would be super appreciated. Also, the current year column is in a character type, not a date currently.
test <- tibble(rep= "John Smith", quarter= "q2", year= 19:23, ideal_year= 2019:2023) %>% mutate(year=as.character(year))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法似乎是:
Easiest way seems to be: