[R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
HI, Dear R community, I try to create 100 dummy variables like the following: ack$id_1 - (ack$ID==1)*1 ack$id_2 - (ack$ID==2)*1 .. . ack$id_100 - (ack$ID==100)*1 I used the following codes: for(i in 1:100){ ack$id_[i] - (ack$ID==i)*1 } But only one column

Re: [R] create dummy variables by for loop

2011-02-24 Thread Jonathan P Daily
it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 02/24/2011 01:23:54 PM: [image removed] [R] create dummy variables by for loop Changbin Du to: r-help@r-project.org 02/24/2011 01:25 PM Sent by: r-help-boun...@r-project.org HI, Dear R community, I

Re: [R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 02/24/2011 01:23:54 PM: [image removed] [R] create dummy variables by for loop Changbin Du to: r

Re: [R] create dummy variables by for loop

2011-02-24 Thread David Winsemius
On Feb 24, 2011, at 1:23 PM, Changbin Du wrote: HI, Dear R community, I try to create 100 dummy variables like the following: ack$id_1 - (ack$ID==1)*1 ack$id_2 - (ack$ID==2)*1 .. . ack$id_100 - (ack$ID==100)*1 I used the following codes: for(i in 1:100){ ack$id_[i] -

Re: [R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
Thanks, David! On Thu, Feb 24, 2011 at 11:30 AM, David Winsemius dwinsem...@comcast.netwrote: On Feb 24, 2011, at 1:23 PM, Changbin Du wrote: HI, Dear R community, I try to create 100 dummy variables like the following: ack$id_1 - (ack$ID==1)*1 ack$id_2 - (ack$ID==2)*1 .. .

Re: [R] create dummy variables by for loop

2011-02-24 Thread Dimitri Liakhovitski
: [image removed] [R] create dummy variables by for loop Changbin Du to: r-help@r-project.org 02/24/2011 01:25 PM Sent by: r-help-boun...@r-project.org HI, Dear R community, I try to create 100 dummy variables like the following: ack$id_1 - (ack$ID==1)*1 ack

Re: [R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 02/24/2011 01:23:54 PM: [image removed] [R] create dummy variables by for loop Changbin Du to: r-help@r-project.org 02/24/2011 01:25 PM