我找到了一些Stata函数,可以快速了解面板的功能非常有用。 xtline是一个。它为您提供了不同线图中变量的概述:每个国家一个,并且在一个窗口中随时间变化。
它看起来像this虽然速度不快,但检查一些操作是否符合你的想法非常有用。有谁知道是否存在类似的东西?如果没有,你的伎俩是什么?
答案 0 :(得分:2)
Simples:
dfr <- data.frame(id = rep(1:5, each = 20), time = rep(1991:2010, 5),
variable = rnorm(100))
等同于xtline
:
library(ggplot2)
ggplot(dfr, aes(x = time, y = variable)) + geom_line() + facet_wrap(~id)
xtline
与overlay
选项等效:
ggplot(dfr, aes(x = time, y = variable, group = id, color = id)) + geom_line()