我将尝试运行以下代码:
我收到了以下错误信息:
去年我运行了非常相似的代码,它可以正常工作,所以我不确定是
感谢您能提供的任何帮助。
我正在尝试运行以下代码:
temp_plotdata <- data.table(Treatment_Code = c('Control', 'Control',
'Second Mailing', 'Second Mailing',
'First Mailing', 'First Mailing'),
Q9 = c(9, 14, 10, 3, 1, 4))
output_gg <-
ggplot(temp_plotdata, aes(x = Q9)) +
geom_histogram(binwidth = 1, fill = 'lightblue') +
geom_vline(data = temp_plotdata[, summary(Q9)[c(2,3,5)], by=Treatment_Code],
aes(xintercept = V1),
linetype = 'dashed', color = 'darkred') +
facet_wrap(~Treatment_Code, ncol = 1)
我收到了以下错误信息:
我知道问题出在代码的Error in provideDimnames(x, sep = sep, base = base) : 'dimnames' applied to non-array
geom_vline
部分,因为当我运行没有这些行或者运行类似geom_vline(xintercept = c(3, 5, 8))
的代码时,它可以正常工作。我也尝试将来自geom_vline
的数据先转换为单独的数据框,但这并没有起作用。去年我运行了非常相似的代码,它可以正常工作,所以我不确定是
geom_vline
发生了什么变化还是由于新数据或一些意外更改导致我的代码不正确。感谢您能提供的任何帮助。