Sorry, that should be:
with(DF, X[Y,])
or
DF[DF$Y, "X"]
On 6/13/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
If DF is your data.frame
with(DF, X[Y])
or
DF$X[DF$Y]
On 6/13/06, Yuri Volchik <volchik2000 at list.ru> wrote:
Hi to all members of this list,
I'm quite a novice to R and was wondering if there is a more elegant
way to solve a following problem:
Suppose we have a dataframe
X Y
.12 TRUE
-.24 TRUE
.. ...
.34 FALSE
i.e. two (or more columns) with data and we want to get vector of X
values conditional on Y values (say only X's when Y=TRUE).
Of course it is possible to do it by looping through the whole
dataframe, i was wondering if there is a a more elegant solution to
this in R?
--
Best regards,
Yuri mailto:volchik2000 at list.ru