【发布时间】:2018-08-29 16:23:18
【问题描述】:
这是我的日期框上的日期列:
data <- data.frame(year_month = c("2015-01-01", "2015-02-01", "2015-03-01", "2015-04-01", "2015-05-01", "2015-06-01"))
class(data$year_month)
[1] "factor"
我试过了:
data$year_month1<-as.Date(as.factor(data$year_month), format="%b %Y")
我想要:
" Jan 2015", "Feb 2015", "Mar 2015", "Apr 2015", "May 2015", "Jun 2105"
会发生什么: 我的 data$year_month1 专栏为空。
我尝试了很多我在这里找到的解决方案,但格式根本没有改变,或者它是空的。
请帮忙>
【问题讨论】: