我使用ggplot()绘制的样本群组数据未按照适当的时间顺序进行颜色编码或显示。下面的代码是用来生成的情节: library(ggplot2)
blues <- colorRampPalette(c('lightblue', 'darkblue'))
p <- ggplot(cohort.chart, aes(x=month, y=users, group=cohort))
p + ge
如何在R中使用as.yearqtr将字符串“Q12000”转换为四分之一格式? 我有四分之三的向量: x <- c("Q12000", "Q22000", "Q32000")
我尝试以下的代码: library(zoo)
as.yearqtr(x, format = "Q%q%Y")
# [1] NA NA NA
结果应该是 “2000 Q1”, “Q2 2000”, “2000 Q3