[R] making an inicator variable

Vincent Goulet vincent.goulet at act.ulaval.ca
Tue Oct 25 22:34:37 CEST 2005


Le 25 Octobre 2005 15:51, Jennifer Dillon a écrit :
> Hello,
>
> I am almost a total novice, and I am sure there must be an easy (and
> basic) way to turn a variable of 1's and 2's into a variable of zeros
> and ones.  This is in a data frame, but if I could do it with vectors,
> that's all I need.
>
> Can someone tell me how?
>
> Thanks so much,
>
> Jen

What about

> x - 1

(where 'x' is a vector of 1's and 2's)?

-- 
  Vincent Goulet, Professeur agrégé
  École d'actuariat
  Université Laval, Québec 
  Vincent.Goulet at act.ulaval.ca   http://vgoulet.act.ulaval.ca




More information about the R-help mailing list