Re: [R] Transform data set

2010-03-23 Thread Wincent
Looks like this way, dat$lrplacepartyclose <- NA dat$lrplacepartyclose[dat$Party_Close=="party1"] <- dat$lrplaceParty1[dat$Party_Close=="party1"] dat$lrplacepartyclose[dat$Party_Close=="party2"] <- dat$lrplaceParty2[dat$Party_Close=="party2"] and goes on and on. On 23 March 2010 17:47, Thomas

Re: [R] Transform data set

2010-03-23 Thread stephen sefick
I am not entirely sure what you are trying to do. Are you wanting to re-arrange the columns or apply some sort of transformation? On Tue, Mar 23, 2010 at 4:47 AM, Thomas Jensen wrote: > Dear R Experts, > > I am having some trouble creating a variable in R. I have data on > self-placement of vote

[R] Transform data set

2010-03-23 Thread Thomas Jensen
Dear R Experts, I am having some trouble creating a variable in R. I have data on self-placement of voters, their placement of parties, and which party they feel closest to. The data is structured like this: Party_Closelrplaceself lrplaceParty1 lrplaceParty2 ... party1