Created
March 31, 2017 17:10
-
-
Save saralilyb/29b0595c961d2af6f6dfb0823fe58bf9 to your computer and use it in GitHub Desktop.
Generate a CoffeeScript dictionary using R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blockprint_training_dim1 <- function(rel, inc, boundary = 50) { | |
# right now this assumes rel = rotation and inc = spacing | |
isafep <- function(x) x < boundary # check if fep | |
isfep <- isafep(rel) # are we a fep? | |
cat("\t{\n") # begin block | |
cat("\t\tstimulus: gabgen(", rel,", ", inc, ")\n", sep = "") # code for generation | |
key_answer_val <- ifelse(isfep, 70, 78) # fep (f) if it's less than 50, n if more | |
cat("\t\tkey_answer: ", key_answer_val, "\n", sep = "") # which button is good? | |
text_to_use_correct <- ifelse(isfep, "fep_correct_text", "notfep_correct_text") | |
cat("\t\tcorrect_text: ", text_to_use_correct, "\n", sep = "") | |
text_to_use_incorrect <- ifelse(isfep, "fep_incorrect_text", "notfep_incorrect_text") | |
cat("\t\tincorrect_text: ", text_to_use_incorrect, "\n", sep = "") | |
cat("\t\tdata:\n") | |
response_text <- ifelse(isfep, "fep", "blicket") | |
cat("\t\t\tresponse: '", response_text, "'\n", sep = "") | |
cat("\t\t\trotation: ", rel, "\n", sep = "") | |
cat("\t\t\tspacing: ", inc, "\n", sep = "") | |
cat("\t\t\treldim: 'rotation'\n") # set this manually | |
cat("\t}\n") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just run it with rel and inc as vectors. You can map things from one to the other pretty easily. Hopefully someone finds this useful.