[R] For-loop dummy variables?
Adrian Dusa
dusa.adrian at gmail.com
Tue Oct 19 12:23:48 CEST 2010
On Tuesday 19 October 2010, Phil Spector wrote:
> I always find R useful to solve problems like this:
>
> dummy = as.numeric(cleary$D1 %in% c(4,6,7))
Indeed, and this works too:
dummy <- 1*(cleary$D1 %in% c(4,6,7))
Adrian
--
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Romania
Tel.:+40 21 3126618 \
+40 21 3120210 / int.101
Fax: +40 21 3158391
More information about the R-help
mailing list