[R] Looking for R Equivalent of Gauss Statements

Francisco J. Bido bido at mac.com
Thu Sep 4 07:50:28 CEST 2003


Hi,

I am translating some Gauss code to R.  Gauss has an interesting way of 
handling constraints.  Observe the following code snipplet:

e1 = x[.,23] .eq 0;  @ remove obs with Regular Hours = 0 @
e2 = x[.,12] .gt 1;   @ remove obs with non-regular work status @
e3 = x[.,4] .lt 15;    @ remove obs with agricultural and mining 
industry code (< 15)@
esum = e1 + e2 + e3;
e = esum .gt 0;      @ remove obs that fail all three of the above 
tests @
x = delif(x,e);

I'm hoping that the above is self explanatory.    Currently I am using 
the  "subset" command in R to compute e1, e2, e3 but the rest is 
tricky: the actual code has several additional constraints and I'm 
ending up with some very ugly buggy code.   Is there a straightforward 
way to do this in R?

Thanks,
-Francisco




More information about the R-help mailing list