Skip to contents

This list of used to automatically call respective parsers. It is primarily used for auto-detection in process_records. In future, it could be possible to hold alternative parsers for different versions of jsPsych (or jspsychread).

Usage

default_parsers()

Value

List of trial types and respective parser functions

Examples

default_parsers()
#> $animation
#> function (d) 
#> {
#>     tibble::tibble(animation_sequence = nested_tibble_from_list(d$animation_sequence), 
#>         response = nested_tibble_from_list(d$response))
#> }
#> <bytecode: 0x55cbd196d298>
#> <environment: namespace:jspsychread>
#> 
#> $`audio-button-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd196a000>
#> <environment: namespace:jspsychread>
#> 
#> $`audio-keyboard-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_character(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd196af18>
#> <environment: namespace:jspsychread>
#> 
#> $`audio-slider-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus), slider_start = v_integer(d$slider_start))
#> }
#> <bytecode: 0x55cbd1967e08>
#> <environment: namespace:jspsychread>
#> 
#> $`call-function`
#> function (d) 
#> {
#>     tibble::tibble(value = list_column_of_vectors(d$value))
#> }
#> <bytecode: 0x55cbd1969180>
#> <environment: namespace:jspsychread>
#> 
#> $`canvas-button-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response))
#> }
#> <bytecode: 0x55cbd1965d28>
#> <environment: namespace:jspsychread>
#> 
#> $`canvas-keyboard-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_character(d$response))
#> }
#> <bytecode: 0x55cbd1966818>
#> <environment: namespace:jspsychread>
#> 
#> $`canvas-slider-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         slider_start = v_integer(d$slider_start))
#> }
#> <bytecode: 0x55cbd1967340>
#> <environment: namespace:jspsychread>
#> 
#> $`categorize-animation`
#> function (d) 
#> {
#>     tibble::tibble(stimulus = list_column_of_vectors(v_character(d$stimulus)), 
#>         response = v_character(d$response), rt = v_integer(d$rt), 
#>         correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd195e4d0>
#> <environment: namespace:jspsychread>
#> 
#> $`categorize-html`
#> function (d) 
#> {
#>     tibble::tibble(stimulus = v_character(d$stimulus), response = v_character(d$response), 
#>         rt = v_integer(d$rt), correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd195f7d8>
#> <environment: namespace:jspsychread>
#> 
#> $`categorize-image`
#> function (d) 
#> {
#>     tibble::tibble(stimulus = v_character(d$stimulus), response = v_character(d$response), 
#>         rt = v_integer(d$rt), correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd195c930>
#> <environment: namespace:jspsychread>
#> 
#> $cloze
#> function (d) 
#> {
#>     tibble::tibble(response = list_column_of_vectors(v_character(d$response)))
#> }
#> <bytecode: 0x55cbd195d928>
#> <environment: namespace:jspsychread>
#> 
#> $`external-html`
#> function (d) 
#> {
#>     tibble::tibble(url = v_character(d$url), rt = v_integer(d$rt))
#> }
#> <bytecode: 0x55cbd1959c00>
#> <environment: namespace:jspsychread>
#> 
#> $`free-sort`
#> function (d) 
#> {
#>     init_locations <- bind_rows(d$init_locations)
#>     final_locations <- bind_rows(d$final_locations)
#>     moves <- bind_rows(d$moves)
#>     locations <- init_locations %>% left_join(final_locations, 
#>         by = "src", suffix = c("_init", "_final"))
#>     tibble::tibble(locations = nested_tibble(locations), moves = nested_tibble(moves), 
#>         rt = v_integer(d$rt))
#> }
#> <bytecode: 0x55cbd19568c0>
#> <environment: namespace:jspsychread>
#> 
#> $fullscreen
#> function (d) 
#> {
#>     tibble::tibble(success = v_logical(d$success))
#> }
#> <bytecode: 0x55cbd19543f0>
#> <environment: namespace:jspsychread>
#> 
#> $`html-button-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd1954ce8>
#> <environment: namespace:jspsychread>
#> 
#> $`html-keyboard-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_character(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd1955a08>
#> <environment: namespace:jspsychread>
#> 
#> $`html-slider-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus), slider_start = v_integer(d$slider_start))
#> }
#> <bytecode: 0x55cbd1952930>
#> <environment: namespace:jspsychread>
#> 
#> $`iat-html`
#> function (d) 
#> {
#>     tibble::tibble(stimulus = v_character(d$stimulus), response = v_character(d$response), 
#>         rt = v_integer(d$rt), correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd1953ce0>
#> <environment: namespace:jspsychread>
#> 
#> $`iat-image`
#> function (d) 
#> {
#>     tibble::tibble(stimulus = v_character(d$stimulus), response = v_character(d$response), 
#>         rt = v_integer(d$rt), correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd194eee0>
#> <environment: namespace:jspsychread>
#> 
#> $`image-button-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd194fea0>
#> <environment: namespace:jspsychread>
#> 
#> $`image-keyboard-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_character(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd1948f50>
#> <environment: namespace:jspsychread>
#> 
#> $`image-slider-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus), slider_start = v_integer(d$slider_start))
#> }
#> <bytecode: 0x55cbd1949ca8>
#> <environment: namespace:jspsychread>
#> 
#> $instructions
#> function (d) 
#> {
#>     view_history_list <- d$view_history
#>     tibble::tibble(rt = v_integer(d$rt), view_history = nested_tibble_from_list(view_history_list))
#> }
#> <bytecode: 0x55cbd1946dc8>
#> <environment: namespace:jspsychread>
#> 
#> $maxdiff
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), label_left = v_character(d$labels$left), 
#>         label_right = v_character(d$labels$right), response_left = v_character(d$response$left), 
#>         response_right = v_character(d$response$right), )
#> }
#> <bytecode: 0x55cbd1947a78>
#> <environment: namespace:jspsychread>
#> 
#> $preload
#> function (d) 
#> {
#>     tibble::tibble(success = v_logical(d$success), timeout = v_logical(d$timeout), 
#>         failed_images = list_column_of_vectors(v_character(d$failed_images)), 
#>         failed_audio = list_column_of_vectors(v_character(d$failed_audio)), 
#>         failed_video = list_column_of_vectors(v_character(d$failed_video)))
#> }
#> <bytecode: 0x55cbd19454c8>
#> <environment: namespace:jspsychread>
#> 
#> $reconstruction
#> function (d) 
#> {
#>     tibble::tibble(start_value = v_real(d$start_value), final_value = v_real(d$final_value), 
#>         rt = v_integer(d$rt))
#> }
#> <bytecode: 0x55cbd1942c40>
#> <environment: namespace:jspsychread>
#> 
#> $resize
#> function (d) 
#> {
#>     tibble::tibble(final_width_px = v_integer(d$final_width_px), 
#>         scale_factor = v_real(d$scale_factor))
#> }
#> <bytecode: 0x55cbd1943a40>
#> <environment: namespace:jspsychread>
#> 
#> $`same-different-html`
#> function (d) 
#> {
#>     stimuli <- d$stimulus
#>     tibble::tibble(stimulus = list_column_of_vectors(v_character(stimuli)), 
#>         response = v_character(d$response), rt = v_integer(d$rt), 
#>         correct = v_logical(d$correct), answer = v_character(d$answer), 
#>         rt_stim1 = v_integer(d$rt_stim1), response_stim1 = v_character(d$response_stim1), 
#>         stimulus1 = v_character(stimuli[[1]]), stimulus2 = v_character(stimuli[[2]]))
#> }
#> <bytecode: 0x55cbd1940818>
#> <environment: namespace:jspsychread>
#> 
#> $`same-different-image`
#> function (d) 
#> {
#>     stimuli <- d$stimulus
#>     tibble::tibble(stimulus = list_column_of_vectors(v_character(stimuli)), 
#>         response = v_character(d$response), rt = v_integer(d$rt), 
#>         correct = v_logical(d$correct), answer = v_character(d$answer), 
#>         rt_stim1 = v_integer(d$rt_stim1), response_stim1 = v_character(d$response_stim1), 
#>         stimulus1 = v_character(stimuli[[1]]), stimulus2 = v_character(stimuli[[2]]))
#> }
#> <bytecode: 0x55cbd1942680>
#> <environment: namespace:jspsychread>
#> 
#> $`serial-reaction-time`
#> function (d) 
#> {
#>     grid_array <- d$grid
#>     target <- d$target
#>     tibble::tibble(grid = list(list2_to_matrix(d$grid)), target_x = v_integer(target[[2]]), 
#>         target_y = v_integer(target[[1]]), rt = v_integer(d$rt), 
#>         response = v_character(d$response), correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd1940488>
#> <environment: namespace:jspsychread>
#> 
#> $`serial-reaction-time-mouse`
#> function (d) 
#> {
#>     grid_array <- d$grid
#>     target <- d$target
#>     response <- d$response
#>     tibble::tibble(grid = list(list2_to_matrix(d$grid)), target_x = v_integer(target[[2]]), 
#>         target_y = v_integer(target[[1]]), rt = v_integer(d$rt), 
#>         response_x = v_integer(response[[2]]), response_y = v_integer(response[[1]]), 
#>         correct = v_logical(d$correct))
#> }
#> <bytecode: 0x55cbd193e1e8>
#> <environment: namespace:jspsychread>
#> 
#> $`survey-html-form`
#> function (d) 
#> {
#>     tibble::tibble(response = list_column_of_vectors(d$response), 
#>         rt = v_integer(d$rt))
#> }
#> <bytecode: 0x55cbd193bff0>
#> <environment: namespace:jspsychread>
#> 
#> $`survey-likert`
#> function (d) 
#> {
#>     responses <- d$response
#>     q_name <- names(responses)
#>     q_values <- unlist(responses)
#>     names(q_values) <- NULL
#>     q_order <- unlist(d$question_order)
#>     q_order1 <- q_order + 1
#>     nq <- length(q_name)
#>     response_tbl <- tibble::tibble(question = q_name, response = q_values, 
#>         order = (1:nq))
#>     tibble::tibble(response = nested_tibble(response_tbl), rt = v_integer(d$rt), 
#>         question_order = list_column_of_vectors(v_integer(q_order1)))
#> }
#> <bytecode: 0x55cbd1936dc8>
#> <environment: namespace:jspsychread>
#> 
#> $`survey-multi-choice`
#> function (d) 
#> {
#>     responses <- d$response
#>     q_name <- names(responses)
#>     q_values <- unlist(responses)
#>     q_order <- unlist(d$question_order)
#>     q_order1 <- q_order + 1
#>     nq <- length(q_name)
#>     response_tbl <- tibble(question = q_name, response = q_values, 
#>         order = (1:nq))
#>     tibble::tibble(response = nested_tibble(response_tbl), rt = v_integer(d$rt), 
#>         question_order = list_column_of_vectors(v_integer(q_order1)))
#> }
#> <bytecode: 0x55cbd1935148>
#> <environment: namespace:jspsychread>
#> 
#> $`survey-multi-select`
#> function (d) 
#> {
#>     responses <- d$response
#>     nq <- length(responses)
#>     response_list <- list()
#>     for (i in 1:nq) {
#>         response_list[[i]] <- tibble(question = names(responses)[i], 
#>             response = single_value(unlist(responses[[i]])), 
#>             order = i)
#>     }
#>     q_order <- unlist(d$question_order)
#>     q_order1 <- q_order + 1
#>     response_tbl <- bind_rows(response_list)
#>     tibble::tibble(response = nested_tibble(response_tbl), rt = v_integer(d$rt), 
#>         question_order = list_column_of_vectors(v_integer(q_order1)))
#> }
#> <bytecode: 0x55cbd1933068>
#> <environment: namespace:jspsychread>
#> 
#> $`survey-text`
#> function (d) 
#> {
#>     responses <- d$response
#>     q_name <- names(responses)
#>     q_values <- unlist(responses)
#>     q_order <- unlist(d$question_order)
#>     q_order1 <- q_order + 1
#>     nq <- length(q_name)
#>     response_tbl <- tibble(question = q_name, response = q_values, 
#>         order = (1:nq))
#>     tibble::tibble(response = nested_tibble(response_tbl), rt = v_integer(d$rt), 
#>         question_order = list_column_of_vectors(v_integer(q_order1)))
#> }
#> <bytecode: 0x55cbd1931420>
#> <environment: namespace:jspsychread>
#> 
#> $`video-button-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd1930e60>
#> <environment: namespace:jspsychread>
#> 
#> $`video-keyboard-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_character(d$response), 
#>         stimulus = v_character(d$stimulus))
#> }
#> <bytecode: 0x55cbd192be30>
#> <environment: namespace:jspsychread>
#> 
#> $`video-slider-response`
#> function (d) 
#> {
#>     tibble::tibble(rt = v_integer(d$rt), response = v_integer(d$response), 
#>         stimulus = v_character(d$stimulus), slider_start = v_integer(d$slider_start), 
#>         start = v_real(single_value(d$start)))
#> }
#> <bytecode: 0x55cbd192cbc0>
#> <environment: namespace:jspsychread>
#> 
#> $`virtual-chinrest`
#> NULL
#> 
#> $`visual-search-circle`
#> function (d) 
#> {
#>     xy <- list2_to_matrix(d$locations)
#>     colnames(xy) <- c("x", "y")
#>     locations <- as_tibble(xy)
#>     tibble::tibble(correct = v_logical(d$correct), response = v_character(d$response), 
#>         rt = v_integer(d$rt), set_size = v_integer(d$set_size), 
#>         target_present = v_logical(d$target_present), locations = nested_tibble(locations))
#> }
#> <bytecode: 0x55cbd192a300>
#> <environment: namespace:jspsychread>
#> 
#> $`webgazer-calibrate`
#> NULL
#> 
#> $`webgazer-init-camera`
#> NULL
#> 
#> $`webgazer-validate`
#> NULL
#> 
# extending parsers
my_parsers <- default_parsers()
my_form_parser <- function(x) { x } # not useful but check parsers.R for inspiration
my_parsers[["survey_html_form"]] <- my_form_parser