if (FALSE) {
library(jmvReadWrite)
set.seed(1)
tmpDF <- stats::setNames(as.data.frame(matrix(sample(6, 1200, replace = TRUE), nrow = 16)),
sprintf("sbj_%03d", seq(75)))
str(tmpDF)
# Data sets that were extracted, e.g., from PsychoPy, may look like this (trials as rows
# and participants as columns, one for each participant, manually assmebled / copy-and-pasted).
# However, for analyses, one wants the data set transposed (units / participants as columns)...
fleTmp <- paste0(tempfile(), ".omv")
transpose_omv(dtaInp = tmpDF, fleOut = fleTmp)
dtaFrm <- read_omv(fleTmp)
str(dtaFrm)
# if no nmeVar-parameter is given, generic variable names are created (V_...)
transpose_omv(dtaInp = tmpDF, fleOut = fleTmp, nmeVar = sprintf("Trl_%02d", seq(16)))
dtaFrm <- read_omv(fleTmp)
str(dtaFrm)
# alternatively, the character vector with the desired variable names (of the same length as
# the number of rows in tmpDF) may be given, "Trl" can easily be exchanged by the name of your
# questionnaire, experimental conditions, etc.
unlink(fleTmp)
}
Run the code above in your browser using DataLab