save_json | R Documentation |
This function does the same as save_lists, but in json format instead of csv format. It will write .js files that you can import directly into your experiment. Stimuli that present multiple levels on a single trial will be saved as an object with the stimulus name. For example, audio_1 = x and audio_2 = y will be converted into audio = audio_1 = x, audio_2 = y. If x and y are greater than length 1 for some reason, they will be converted to an an array within the audio object.
save_json( design, filename = gsub(" ", "_", design[["name"]]), objectname = "stimulist", extension = ".json", separate_items = FALSE, as_one_file = FALSE, remove_type = FALSE )
design |
Experimental design |
filename |
Filename you want to use for each list (number will be appended) |
objectname |
Name you want to use for the js object in the file |
extension |
File extension, defaults to .js |
separate_items |
Should different item types be saved in separate files |
as_one_file |
Should all stimuli be saved as one file (NOT recommended) |
remove_type |
Should the type column be removed from the output file? If TRUE and there's only 1 type, the item column is renamed to the 1 value of the type column. If FALSE, type column is retained. If a string, will remove the type column and rename the item column to the given string. |
If you use a .js extension, it will save a javascript file with the list saved to the object name given with objectname. Using .json will prevent this.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.