Here 2 options for subsetting:
Using subset from base R:
library(ggplot2)
ggplot(subset(dat,ID %in% c("P1" , "P3"))) +
geom_line(aes(Value1, Value2, group=ID, colour=ID))
Using subset the argument of geom_line(Note I am using plyr package to use the special . function).
library(plyr)
ggplot(data=dat)+
geom_line(aes(Value1, Value2, group=ID, colour=ID),
,subset = .(ID %in% c("P1" , "P3")))
You can also use the complementary subsetting:
subset(dat,ID != "P2")