[R] Looking for R Equivalent of Gauss Statements
Francisco J. Bido
bido at mac.com
Thu Sep 4 17:23:51 CEST 2003
Thanks Marlene, that's exactly what I was hoping for.
Best,
-Francisco
On Thursday, September 4, 2003, at 02:37 AM, Marlene Mueller wrote:
>
> R is very similar to Gauss for this kind of task.
> Try:
>
> e1 <- x[,23] == 0
> e2 <- x[,12] > 1
> e3 <- x[,4] < 15
> e <- e1 | e2 | e3 # e1 or e2 or e3
> x <- x[!e,] # keep if NOT e
>
> Hope that helps,
> Marlene
>
>
>
> Francisco J. Bido wrote:
>> 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
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>
> --
> PD Dr. Marlene Müller
> Fraunhofer ITWM Kaiserslautern, Abt. Finanzmathematik
> mailto:Marlene.Mueller at itwm.fraunhofer.de, Tel/Fax: +49 631 205
> 4189/4139
> http://www.itwm.fhg.de/index.php?abt=fm/employees/mueller&inc=mueller
>
More information about the R-help
mailing list