transformations: Mutating and transforming faces objects.

transformationsR Documentation

Mutating and transforming faces objects.

Description

Mutate_faces and transfrom_faces are metafunctions that allow to create new variables in all the dataframes of a face object. Mutate_faces adds a new variables by writing their name and a formula (see examples). It is the openfacer equivalent of dplyr::mutate. Transform_faces use functions that take as input a whole face dataframe.

Usage

mutate_faces(faces, ...)

transform_faces(faces, var, fun)

Arguments

faces

A "faces" object.

...

only in mutate_faces. Pairs of expression inluding a name and the formula for caluclating the value.

var

The name, as a string, of the new variable created (transform_faces).

fun

The name of the function to use (transform_faces)

Examples


#Create a "smiles" variable
#' mutate_faces(test_faces, smile = ifelse(AU06_c == 1 & AU12_c == 1, 1, 0))

#Create a mei variable, select it and summarise
test_faces %>%
transform_faces("mei", mei) %>%
select_faces(mei) %>%
tidy_face()


davidecannatanuig/openFaceR documentation built on Feb. 28, 2024, 7:21 p.m.