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

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

# 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)
#> # A tibble: 102 x 2 #> id VS #> <chr> <dbl> #> 1 001 -1.06 #> 2 002 0.00299 #> 3 003 -0.250 #> 4 004 0.855 #> 5 005 0.548 #> 6 006 0.582 #> 7 007 -1.16 #> 8 008 1.50 #> 9 009 -1.16 #> 10 010 0.391 #> # … with 92 more rows
# 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)
#> # A tibble: 102 x 2 #> id VS #> <chr> <dbl> #> 1 001 -0.990 #> 2 002 0.121 #> 3 003 -0.205 #> 4 004 0.748 #> 5 005 0.555 #> 6 006 0.526 #> 7 007 -1.20 #> 8 008 1.48 #> 9 009 -1.14 #> 10 010 0.473 #> # … with 92 more rows