Skip to content

Instantly share code, notes, and snippets.

@mark-andrews
Last active March 29, 2018 17:02
Show Gist options
  • Save mark-andrews/c4bfe8aa4d155d23292544c95695e732 to your computer and use it in GitHub Desktop.
Save mark-andrews/c4bfe8aa4d155d23292544c95695e732 to your computer and use it in GitHub Desktop.
Record accuracy in tricky data set
correct_response_map_1 <- or$correct[1:8]
correct_response_map_2 <- or$correct.1[1:8]
names(correct_response_map_1) <- or$key_config_1[1:8]
names(correct_response_map_2) <- or$key_config_2[1:8]
new_or %>% mutate(correct_response_num_if_1 = correct_response_map_1[stim_type],
correct_response_num_if_2 = correct_response_map_2[stim_type],
correct_reponse_num = (Key_config == 1)*correct_response_num_if_1 + (Key_config == 2)*correct_response_num_if_2,
accuracy = correct_reponse_num == response_num)
@mark-andrews
Copy link
Author

Line 8 is a bit funny looking. Ultimately, it selects the value in correct_response_num_if_1 whenever Key_config is 1 and selects correct_response_num_if_2 whenever Key_config is 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment