angleDist: Computes distance and angle from marker columns

View source: R/angleDist.R

angleDistR Documentation

Computes distance and angle from marker columns

Description

Computes the distance and the angle for a (mean, median) x/y marker point. The distance and the angle is computed from x = 0, y = 0 to the x/y - values given. Therefore, to get correct values for distance and angle use the function centerCond before, to set the x/y-start values for each condition to x = 0, y = 0.

Usage

angleDist(data, colNames, colNameSubj, rndDig = 2, verbose = FALSE)

Arguments

data

Data frame containig the data for a subset, defined in colNames, for which the angle and the distance should be computed for.

colNames

Character vector naming the two columns with the x/y-Values for which the angle and the distance should be computed.

colNameSubj

Character vector with a single value containig the name of the subject column of the data data-frame.

rndDig

Number of round digits. Default is 2.

verbose

If TRUE, the function prints verbose output. Otherwise not. Default is FALSE.

Value

Numeric matrix with median distance and angle.

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")

# Data preparation
data_Subj_happy <- subset(dataSmm, subset = dataSmm["Stimulustype"] == "posed_happy",
                          select = c("subject",colNames))
angleDist(data_Subj_happy, colNames = c("CL7_x", "CL7_y"),
          colNameSubj = "subject", rndDig = 3)


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