Displaying 1 result from an estimated 1 matches for "var_interest".
2009 Feb 11
2
How to apply table() on subdata and stack outputs
...s very large so a for loop is what I try to avoid.
Can someone englithen me how to use sapply or the like to achieve it?
Many thanks in advance!
-Sean
#example input dataframe
id <- c('tom', 'tom', 'tom', 'jack', 'jack', 'jack', 'jack')
var_interest <- 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_f...