calc_shapevs: Calculate vector scores from Procrustes-aligned landmark...

Description Usage Arguments Value Examples

View source: R/calc_shapevs.R

Description

Function projects data onto vector from anchor one (score of 0) to anchor two (score of 1). See calc_vs

Usage

1
2
3
4
5
6
7
calc_shapevs(
  data,
  anchor1_index,
  anchor2_index,
  symm = FALSE,
  mirroredlandmarks
)

Arguments

data

Output from facefuns

anchor1_index

Vector specifying indices of faces which will constitute lower anchor point

anchor2_index

Vector specifying indices of faces which will constitute upper anchor point

symm

Symmetrize templates prior to calculating vector scores

mirroredlandmarks

Vector specifiying order of mirrored landmarks (required for symmetrizing)

Value

Returns tibble with columns "id" and "VS". If data contained rownames, these will be saved as ids.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# READ AND PREP DATA
path_to_tem <- system.file("extdata", "tem", package="facefuns")

shapedata <- facefuns(data = read_lmdata(lmdata = path_to_tem,
                                         plot = FALSE),
                      remove_points = "frlgmm",
                      plot_sample = FALSE,
                      quiet = TRUE)

# CREATE ANCHORS, e.g. female and male averages
data("LondonSet_info")

# Specify indices of faces that will constitute male and female averages
fem_i <- gsub("^ID=","", dimnames(shapedata$aligned)[[3]]) %in%
LondonSet_info$face_id[which(LondonSet_info$face_sex == "female")]

mal_i <- gsub("^ID=", "", dimnames(shapedata$aligned)[[3]]) %in%
LondonSet_info$face_id[which(LondonSet_info$face_sex == "male")]

# CALCULATE FEMALE-MALE VECTOR SCORES
calc_shapevs(shapedata, fem_i, mal_i)


# CALCULATE FEMALE-MALE VECTOR SCORES FROM SYMMETRIZED FACES
# To symmetrize faces before calculating vector scores,
# you will have to provide indices of landmarks after mirroring

data("mirroredlandmarks")

calc_shapevs(shapedata, fem_i, mal_i,
             symm = TRUE, mirroredlandmarks = mirroredlandmarks)

iholzleitner/facefuns documentation built on March 19, 2021, 2:43 p.m.