[R-gui] extracting parts of words or extraxting letter to use in ifelse-func.

Martin Maechler maechler at stat.math.ethz.ch
Fri Feb 13 09:43:24 CET 2009


>>>>> "j" == joe85  <johannes at dsr.life.ku.dk>
>>>>>     on Thu, 12 Feb 2009 06:16:02 -0800 (PST) writes:

    j> Hello

    j> I want to make some variables with the ifelse-function, but i don't know how
    j> to do it.

    j> I want to make these five variables;

    j> b2$PRRSvac <- ifelse(b2$status=='A' | b2$status=='Aa',1,0) 
    j> b2$PRRSdk <- ifelse(b2$status=='B' | b2$status=='Bb',1,0) 
    j> b2$sanVac <- ifelse(b2$status=='C' | b2$status=='sanAa',1,0) 
    j> b2$sanDk <- ifelse(b2$status=='D'  | b2$status=='sanBb',1,0) 
    j> b2$totalvac <- ifelse(b2$status=='San',1,0)

    j> And 

    j> b2$UGT <- ifelse(b2$status=='UGT',1,0)
    j> b2$KOM <- ifelse(b2$status=='KOM',1,0)

What has this to do with  R-gui ??????

Please use  R-help  for such questions !!!

Martin Maechler, ETH Zurich


        [................]



More information about the R-SIG-GUI mailing list