【发布时间】:2016-02-17 13:54:29
【问题描述】:
假设我有一个包含两个纵向变量的数据(x1, x2),t 是时间(年),type 是类:
set.seed(20)
x1 = rnorm(20,5,1)
x2 = (x1 + rnorm(20))
t = rep(c(0,1,2,3), 5)
id = rep(1:5,each = 4)
type = as.factor(c(rep(0,8), rep(1,12)))
df = data.frame(id, t, x1, x2, type)
是否可以在一个图中绘制x1 和x2 agnist t?实际上,我试图通过修改相关矩阵来查看x1 和x1 之间的关系(但这里使用 rnorm 使其变得容易)。
【问题讨论】: