I currently have code that scores whether subject responses in column 1 match the correct responses in column 2, and this works fine for subject responses that are spelled correctly or include at least one correct word in the response e.g., subject response: Sphinx ; correct response: Great Sphinx".
However, I am having trouble scoring subject responses that are incorrectly spelled e.g, Pizza instead of Pisa or when the subject uses a different word but it is still a correct match e.g, O2 Arena instead of Millennium Dome. Is there a way to modify the code below or add a new code for it to also give a score of 0 or 1 for responses in column 1 that are misspelled or do not match the words in column 2 but are still a correct response?
Any suggestions would be greatly appreciated.
data_recall<- data.frame(correct_responses= c("Gondola On Canal", "Sphinx", "Don't Know", "Millennium Dome", "Pisa"), subject_responses = c("Grand Canal Venice", "Great Sphinx", "Mountain Everest","02 Arena","Leaning tower of Pizza")) data_recall[] <- str_to_title(data_recall[]) data_recall$recall_MATCH<-apply(data_recall, 1, function(x) ifelse(any(unlist(strsplit(as.character(x),"\\s+")) %in% unlist(strsplit(as.character(x),"\\s+"))),'1','0'))