Displaying 1 result from an estimated 1 matches for "xreshape".
Did you mean:
reshape
2005 Feb 26
1
reshape without timevar argument?
...d Freq to each id
xFreqdf <- merge(df, table(df['id']), by.x='id', by.y='Var1')
xFreq <- xFreqdf[,'Freq']
#general way of transforming xFreq into:
xFreq2 <- c(3:1, 5:1, 2:1, 5:1)
#substitute Freq by xFreq2
xFreqdf['Freq'] <- xFreq2
#get final df
xReshape <- reshape(xFreqdf, idvar='id', v.names='let',
timevar='Freq', direction='wide')
The final data.frame doesn't order the columns in the way I would
think the more obvious: let.1 is actually the 4th column instead of
the second one.
I ag...