Skip to content
Prev 58948 / 398502 Next

Simple operation on a subset of data

On Fri, 12 Nov 2004, Giacomo De Giorgi wrote:
There are actually worse problems with
   if((x=1) & (y=4)) summary(z) 
than that: you have just set x to 1 and y to 4.

You can do
    summary(z[(x==1) & (y==4)])
to get the answer you want (or various other things)

You really need to read the Introduction to R, which will tell you, among 
other things, what the = operator does.

 	-thomas