I have a 138x50 data frame of the following type:
B = matrix( c("ehre","e", "eh", "ehr", "ehrr", "f", "fi", "fie", "fiee", "fiel", "seil", "s", "se", "sei", "seii", "leiht", "l", "le", "lei", "leih", 3, 0, 0, 0, 1), nrow=5, ncol=5, byrow = FALSE) colnames(B)<-c("ana1_1", "ana2_1", "ana3_1", "ana4_1", "points")
I want to create a new df "A" containing only the correct answers and replacing the incorrect answers with the empty / NA cell:
A = matrix( c("ehre",NA, NA, NA, NA, NA, NA, NA, NA, "fiel", "seil", NA, NA, NA, NA, "leiht", NA, NA, NA, NA, 3, 0, 0, 0, 1), nrow=5, ncol=5, byrow = FALSE) colnames(A)<-c("ana1_1", "ana2_1", "ana3_1", "ana4_1", "points")
- How do I create A, and not by deleting the wrong one, but choosing the correct answers? (since this will require fewer responses per type).
- How to count the number of rows in a row (to create column 5)?
Thank you very much for your response!