Re: [R] which() in subset()

2012-07-13 Thread Charles Stangor
Thanks Dennis and Mike... I'm getting it!!! Sent from my Android Rui Barradas wrote: >Hello, > >To know why, just evaluate the condition, with 't1$' before 'version_1': > >which(as.character(t1$version_1) %in% a) != 0 >[1] TRUE TRUE > > >It allways evaluates to TRUE, therefore, subset() returns

Re: [R] which() in subset()

2012-07-13 Thread Rui Barradas
Hello, To know why, just evaluate the condition, with 't1$' before 'version_1': which(as.character(t1$version_1) %in% a) != 0 [1] TRUE TRUE It allways evaluates to TRUE, therefore, subset() returns all rows. See if this isn't simpler than both of your forms. v2 <- subset(t1, version_1 %in% a

[R] which() in subset()

2012-07-13 Thread Charles Stangor
Why does the subset not work in the which() version below? Thank you v1 <- subset(t1, version_1==as.character("100-1") | version_1==as.character("100-2")) a<-c("100-1", "100-2") v1 <- subset(t1, which(a==as.character(version_1)) != 0) [[alternative HTML version deleted]] ___