[R] Subset and logical operator error

Ken Knoblauch knoblauch at lyon.inserm.fr
Tue Jun 12 23:18:23 CEST 2007



Sébastien <pomchip <at> free.fr> writes:

> 
> Can you please point to me my syntax mistake or indicate a method to get 
> this type of data.frame subset ?
> 
> Thank you in advance
> 
>   ID value
> 1  1   1.2
> 2  2   1.2
> 3  3   1.2
> 4  4   1.2
> 5  5     A
> 6  6     A
> 7  7     A
> 8  8     A
> subset(mdat,value!"A")
> 
> Error: syntax error, unexpected '!', expecting ',' in "subset(mdat,value!"
> 
Looks like you forgot the "=" as in

subset(mdat, value != "A")
  ID value
1  1   1.2
2  2   1.2
3  3   1.2
4  4   1.2



More information about the R-help mailing list