Displaying 1 result from an estimated 1 matches for "xfreqdf".
Did you mean:
xfreq
2005 Feb 26
1
reshape without timevar argument?
...n this convulated
way there is a step that I can't solve. I used a "fake" timevar using
the table function.
df <- data.frame(id=c(rep('IDa',3), rep('IDb', 5), rep('IDc', 2),
rep('IDd',5)), let=letters[1:5])
#add 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(xF...