# createSession.R # # # Input: # Output: # # Contents: # # created 13-03-2020, KN # last mod 15-03-2020, KN nsubj <- 10 # subjects nrep <- 15 # repetitions CONSONANTS <- LETTERS[!LETTERS %in% c("A", "E", "I", "O", "U")] items <- c(CONSONANTS, 1:9) cond <- c("full", "upperPartial", "middlePartial", "lowerPartial") nrows <- nrep * length(cond) for(i in seq_len(nsubj)) { # subject loop fname <- paste0("ses", sprintf("%02d", i), ".txt") df <- data.frame(t(replicate(nrows, sample(items, 12, replace=TRUE))), sample(rep(cond, nrep), nrows)) write.table(df, fname, sep=";", col.names=FALSE, row.names=FALSE, quote=FALSE) }