# a synthetic square grayscale image stands in for a real base face photo
base_face <- tempfile(fileext = ".png")
png::writePNG(matrix(runif(32 * 32), 32, 32), base_face)
stimulus_path <- tempdir()
generateStimuli2IFC(
base_face_files = list(face = base_face),
n_trials = 6,
img_size = 32,
stimulus_path = stimulus_path,
seed = 1,
ncores = 1,
nscales = 1,
save_as_png = FALSE
)
rdata_file <- list.files(stimulus_path, pattern = "\\.Rdata$", full.names = TRUE)[1]
# two "participants", three trials each
data <- data.frame(
participant = rep(c("p1", "p2"), each = 3),
stimulus = 1:6,
response = sample(c(1, -1), 6, replace = TRUE)
)
cis <- suppressWarnings(batchGenerateCI(
data = data, by = "participant", stimuli = "stimulus", responses = "response",
baseimage = "face", rdata = rdata_file, save_as_png = FALSE
))
Run the code above in your browser using DataLab