My dataframe contains the responses my students provided in an online exam/ test and I'm after some help in analyzing one of the questions. It's a little tricky to explain how the question was structured but I'll do my best. Each participant was put in two weather scenarios (which were chosen randomly between 5 possible scenarios: storm, wind, persistent, wet & loose)
They were then asked to state whether 6 different travel techniques were applicable in their two scenarios. For simplification purposes, the travel techniques were (Chute, Lee, Early, Wait48, Solar & Conn).
All students were asked had to state how applicable each travel technique would be in each weather scenario and the options they had to choose between were: a) highly applicable b) somewhat applicable c) not applicable d) don't know
For each of the 5 weather scenarios, there is 1 travel technique that is highly applicable, apart from for wet, which has 2.
Correct highly applicable answers are follows: Storm - Wait48 Wind - Lee Persistent - Conn Wet - Early & Solar Loose - Chute
What I'm interested in asking here, is how can I create a new column in my DF, that tallies up whether each student (each row) got none of the 'highly applicables' correct, got 1 correct, or got 2?
# Example results table
# Note the numbers relate to the student's responses as follows:
# 0= Not applicable, 1= Somewhat Applicable, 2= Highly applicable NA = Don't
know
WeatherScen1 <- c('storm', 'persistent', 'wet', 'wet', 'storm', 'wind',
'Ldry')
Solar1 <- c(0, 1, 2, 0, 0, NA, 2)
Conn1 <- c(1, 2, 0, 2, 0, NA, 1)
Chute1 <- c(1, 1, 1, 2, 2, NA, 1)
Early1 <- c(0, 1, 2, 1, 1, NA, 2)
Wait481 <- c(2, 0, 0, 2, 1, NA, 2)
Lee1 <- c(1, 1, 1, 0, 1, NA, 1)
WeatherScen2 <- c('wet', 'wet', 'wind', 'storm', 'Ldry', 'storm',
'persistent')
Solar2 <- c(2, 2, 0, 0, 0, 1, 0)
Conn2 <- c(0, 0, 1, 1, 0, 1, 2)
Chute2 <- c(1, 1, 1, 1, 1, 1, 1)
Early2 <- c(2, 2, 1, 1, 1, 1, 0)
Wait482 <- c(0, 0, 1, 1, 1, 2, 0)
Lee2 <- c(1, 1, 2, 1, 1, 1, 0)
If we just focus on whether students were able to correctly identify the travel techniques that are highly applicable (2s), then rows/ students 1, 2 & 3 got both their weather scenarios correct, students/rows 4 & 5 got both weather scenarios wrong and students/rows 6 & 7 got their first scenario wrong but their second right.
How can I create an additional column called something like 'no of highly applicables correct' that would display 2 points for students 1 2 & 3, 0 points for students 4 & 5 and 1 point for students 6 & 7?
Many thanks in advance for your help
Aucun commentaire:
Enregistrer un commentaire