ItemFileIA <- function(dat, env = parent.frame(n = 1)) {
# create output slot
if (env$exp$setup$type == "target" | env$exp$setup$type == "boundary" | env$exp$setup$type == "fast") {
item <- data.frame(matrix(NA, 1, 9))
colnames(item) <- c("subid", "trialid", "trialnum", "itemid", "cond", "sentnum",
"ianum", "ia", "target")
} else {
item <- data.frame(matrix(NA, 1, 8))
colnames(item) <- c("subid", "trialid", "trialnum", "itemid", "cond", "sentnum",
"ianum", "ia")
}
# trial loop
for (trial in 1:length(dat$item)) {
# trial = 1
itemtmp <-
dat$item[[trial]]$meta$stimmat[duplicated(dat$item[[trial]]$meta$stimmat$ianum) == F, ]
if (env$exp$setup$type == "target" | env$exp$setup$type == "boundary" | env$exp$setup$type == "fast") {
names <- c("subid", "trialid", "trialnum", "itemid",
"cond", "sentnum", "ianum", "ia", "target")
} else {
names <- c("subid", "trialid", "trialnum", "itemid",
"cond", "sentnum", "ianum", "ia")
}
itemtmp <- itemtmp[names]
# add to output
item <- rbind(item, itemtmp)
}
# save
item <- item[-1, ]
return(item)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.