centerCond: Center marker coordinates

View source: R/centerCond.R

centerCondR Documentation

Center marker coordinates

Description

Sets the x/y/z-values of markers in parameter colNames defined variable columns to 0 at the start of every condition defined in parameter colNameCond. This is done for every subject defined by column colNameSubj.

Usage

centerCond(
  data,
  colNames,
  colNameSubj,
  colNameFrames,
  colNameCond,
  maxCPUcores = 4,
  verbose = FALSE
)

Arguments

data

Data frame containig the columns which should be centered and additional columns defining subject number, stimulus conditions, frames, etc. Columns not to be centered will return unchanged.

colNames

Character vector with names of the columns which should be centered.

colNameSubj

Character vector with a single value containig the name of the subject column. It is assumed, that each experimental condition occurres only once per subject

colNameFrames

Character vector with a single value containig the name of the frames column.

colNameCond

Character vector with a single value containing the experimental conditions column name of the data frame.

maxCPUcores

Optional integer value. Per default, all available CPU cores up to 4 are used. If more or less cores should be used, set it via the parameter maxCPUcores (e.g., maxCPUcores = 12).

verbose

If TRUE, the function prints verbose output. Otherwise not.

Value

Data frame with centered columns per subject and per stimulus condition.

Author(s)

Axel Zinkernagel zinkernagel@uni-wuppertal.de

Examples

colNames <- c("A7_x",  "A7_y",  "A8_x",  "A8_y",  
             "BL2_x", "BL2_y", "BL4_x", "BL4_y",  
             "BL5_x", "BL5_y", "BL7_x", "BL7_y",        
             "BR2_x", "BR2_y", "BR4_x", "BR4_y",  
             "BR5_x", "BR5_y", "BR7_x", "BR7_y",  
             "CL4_x", "CL4_y", "CL7_x", "CL7_y",        
             "CR4_x", "CR4_y", "CR7_x", "CR7_y",  
             "DL2_x", "DL2_y", "DR2_x", "DR2_y")
              
# To not overwrite existing data, use a new data frame 
# (dataStdFCen means data of standaradized faces, centered)

dataStdFCen <- centerCond(dataStdF, colNames = colNames, 
                          colNameSubj = "subject", colNameFrames = "Frame", 
                          colNameCond = "Stimulustype", maxCPUcores = 1,
                          verbose = TRUE)


axzinker/blenderFace documentation built on Feb. 27, 2024, 10:25 a.m.