analytics - multi response sets in R -


i have multi response set

df<-data.frame(id=seq(10), r1=sample(seq(10), 10, replace=t), r2=sample(seq(10), 10, replace=t), r3=sample(seq(10), 10, replace=t)) 

where id respondent id, , r1-r3 responses question example: favorite food? answers coded 1-10, each variable represents food type (i.e. 1- pizza, 2- burger etc) - same labels each r1-r3. want create table id , different food types columns , in rows 1 or 0 if given food type has been selected person example

id 1 2 3 4 1  0 1 1 0 

which imply responded number 1 food number 2 , 3. there smart way in r?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -