Sorry. In dplyr: data %>% filter(col == "blue", cycle ==1) %>% select(values)
On Tue, Aug 4, 2015 at 19:54 James Hedges <jhedg...@gmail.com> wrote: > cycle %>% filter(col == "blue", cycle == 1) > On Tue, Aug 4, 2015 at 18:59 Rodrigo Díaz <rodlupa...@hotmail.com> wrote: > >> Hi. I have a matrix like this: >> >> cycle=c(rep(1,3),rep(2,3),rep(3,3),rep(4,3))col=c(rep("blue",2),rep("green",2),rep("blue",2),rep("green",2),rep("blue",2),rep("green",2))values=c(1:12)data.frame(cycle,col,values) >> # cycle col values#1 1 blue 1#2 1 blue 2#3 >> 1 green 3#4 2 green 4#5 2 blue 5#6 2 blue >> 6#7 3 green 7#8 3 green 8#9 3 blue 9#10 >> 4 blue 10#11 4 green 11#12 4 green 12 >> I want to select or extract values matching 2 conditions. For example: >> values from col "blue" and cycle "1". If I use : values[col==blue] I get >> all blue values. I tried using values[c(col==blue,cycle==1)] but is not >> working. Please help. I have a very big data matrix and I do not wanna go >> to excel and start cutting the data. Thanks. >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.