I have a dataframe:
participants <- c(A, A, A, B, C, C)
answers <- c(alpha, beta, gamma, beta, beta, gamma)
participants answers
A alpha
A beta
A gamma
B beta
C beta
C gamma
The 'answers' column contains many more than just this little set.
how do I make it into binary features like the following:
participant answers value
A alpha 1
A beta 1
A gamma 1
B alpha 0
B beta 1
B gamma 0
C alpha 0
C beta 1
C gamma 1
My guess is that I have to get the levels of the 'answers' and the 'participants' too?
But I'm not sure how to do it next. Thanks!