R 如何删除面板标题并将点添加到晶格打印

R 如何删除面板标题并将点添加到晶格打印,r,label,lattice,points,R,Label,Lattice,Points,我有两个数据帧: df1 <- read.table(text = " Time Score ID -83 19 C1 -69 17 C2 -55 15 C3 -28 22 C4 0 27 C5", header=TRUE) df2 <- read.table(text = " Time Score ID -83 19 C1 -55 15

我有两个数据帧:

df1 <- read.table(text = "
Time    Score   ID
 -83       19   C1
 -69       17   C2
 -55       15   C3
 -28       22   C4
   0       27   C5", header=TRUE)

df2 <- read.table(text = "
Time    Score   ID
 -83       19   C1
 -55       15   C3
   0       27   C5", header=TRUE)

请给出建议,说明如何不标记每个ID(删除面板标题),然后将df2作为点添加到现有绘图

设置
strip=FALSE
以抑制“面板标题”。然后,在注意确保两个data.frame中的
ID
因子级别匹配后,可以使用
latticeExtra::as.layer()
将第二个data.frame中的数据绘制到使用第一个data.frame构建的绘图上:

library(latticeExtra)

## Fiddly bit needed to make sure, e.g., that level `C3` is coded 
## using the same number (here a '3') in both ID columns.
df2$ID <- factor(df2$ID, levels = levels(df1$ID))

## Plot data from both data.frames onto the same plot
xyplot(Score ~ Time | ID, data = df1, type ="b", cex = .5, strip = FALSE) + 
as.layer(xyplot(Score ~ Time | ID, data = df2, type ="b", 
                cex = 5, drop.unused.levels = FALSE))
库(latticeExtra)
##需要精确的位来确保,例如,“C3”级已编码
##在两个ID列中使用相同的数字(此处为“3”)。

df2$ID感谢Psidom提供的格式可能会有所帮助。df2是df1的子集,具有相同的值。df2值将超过df1值。这就是你想要的吗?非常感谢Josh!工作得很漂亮@用户2783615很酷。很高兴听到这有帮助!
library(latticeExtra)

## Fiddly bit needed to make sure, e.g., that level `C3` is coded 
## using the same number (here a '3') in both ID columns.
df2$ID <- factor(df2$ID, levels = levels(df1$ID))

## Plot data from both data.frames onto the same plot
xyplot(Score ~ Time | ID, data = df1, type ="b", cex = .5, strip = FALSE) + 
as.layer(xyplot(Score ~ Time | ID, data = df2, type ="b", 
                cex = 5, drop.unused.levels = FALSE))