我正在尝试从 ggridges 包中绘制一个joyplot图(随时间变化的密度分布)。文件“Dados empilhados”是一个汇集数据集。
library(ggridges)
library(ggplot2)
library(XLConnect)
data = loadWorkbook('Dados empilhados.xls')
data = readWorksheet(data, sheet = 'Sheet1', header = T)
ggplot(data[data$Time>0,], aes(x = betas.dyn, y = Time, group = Time)) +
geom_density_ridges(scale = 10, size = 0.25, rel_min_height = 0.03) +
theme_ridges() +
scale_x_continuous(limits=c(0.0, 1.3), expand = c(0.01, 0)) +
scale_y_reverse(breaks=c(2016, 2012, 2008, 2004, 2001), expand = c(0.01, 0))
但我收到以下错误:
Error in -x : invalid argument to unary operator
Obs.: 达多斯 empilhados:
Time Country betas betas.dyn
2001-Q1 Angola 10.02 12.23
2001-Q2 Angola 14.53 13.45
2001-Q3 Angola 13.32 11.74
. . . .
. . . .
. . . .