[R] From SPSS Syntax to R code

John jwd at surewest.net
Mon Feb 14 03:54:21 CET 2011


On Saturday, February 12, 2011 05:08:06 am beky wrote:
> There is a code from SPSS Syntax
> 
> do if sub(ATVK,2,2)="01".
> comp strata=1.
> else if sub(ATVK,2,2)>="05" and sub(ATVK,2,2)<="27".
> comp strata=3.
> else if sub(ATVK,4,2)>"20" or sub(ATVK,6,2)>"20".
> comp strata=4.
> else if sub(ATVK,4,2)>"00".
> comp strata=2.
> end if.
> 
> value labels strata 1 "R 2 "Li" 3 "M" 4 "La".
> 
> How can i rewrite it in R code?
It would be helpful if an example of data were included in your request.  BTW, 
I believe there's a missing '"' in the last line of code.  Shouldn't "R be 
"R"?

JWDougherty



More information about the R-help mailing list