"name1","name2","name3"の行だけをとりだす。
g<-c("name1","name2","name2","name3","name6","name4","name6") x<-c(3,4,5,2,1,4,5) y<-3*x+rnorm(length(x)) r1<-data.frame(x,y,g) list1<-c("name1","name2","name3") r1b<-dplyr::filter(r2,r2$g %in% list)
ついでにグラフをかく。
ggplot(r1b)+geom_line(aes(x=x,y=y,group=g,colour=g))