Displaying 1 result from an estimated 1 matches for "happy_freq".
Did you mean:
unhappy_freq
2009 Feb 11
2
How to apply table() on subdata and stack outputs
...nterest <- c("happy","unhappy", "", "happy", "unhappy", 'soso','happy')
input.df <- data.frame(id=id, var_interest=var_interest)
input.df
wanted.df <-
#output dataframe I want
id_unique <- c('tom','jack')
happy_freq<-c(1,2)
unhappy_freq<-c(1,1)
soso_freq<-c(0,1)
miss_freq<-c(1,0)
output.df <-data.frame(id_unique=id_unique, happy_freq=happy_freq,
unhappy_freq=unhappy_freq, soso_freq=soso_freq, miss_freq=miss_freq)
output.df
[[alternative HTML version deleted]]