Following the example here: input format for binomial glm in R, I have a dataset with y = cbind(success, failure))
with each row representing one treatment.
My question is: How do I convert this to a "binary" format for each observation (e.g., y = 0 or 1 for each observation)? Working example here:
df1 <- data.frame(time = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2),
symb = c('a', 'a', 'a', 'b', 'b', 'b','a', 'a', 'a', 'b', 'b', 'b'),
success= c(324,234,123,234,424,323,124,537,435,645,231,234),
failure= c(84,23,20,74,44,73,12,59,41,68,23,34))
Where success = 1 and failure = 0, and the final dataframe will have 4423 rows (sum(df1$success)+sum(df1$failure)
). This answer gets to where I'm trying to go.