Momocs (version 1.3.2)

chop: Split to several objects based on a factor

Description

Rougher slicing that accepts a classifier ie a column name from the $fac on Momocs classes. Returns a named (after every level) list that can be lapply-ed and combined. See examples.

Usage

chop(.data, fac)

Arguments

.data

a Coo or Coe object

fac

a column name from the $fac

Value

a named list of Coo or Coe objects

See Also

Other handling functions: arrange(), at_least(), combine(), dissolve(), fac_dispatcher(), filter(), mutate(), rename(), rescale(), rm_harm(), rm_missing(), rm_uncomplete(), rw_fac(), sample_frac(), sample_n(), select(), slice(), subsetize()

Examples

Run this code
# NOT RUN {
 olea %>%
      filter(var == "Aglan") %>% # to have a balanced nb of 'view'
      chop(~view) %>%    # split into a list of 2
      npoly %>%          # separately apply npoly
                         # strict equivalent to lapply(npoly)
      combine %>%       # recombine
      PCA %>% plot      # an illustration of the 2 views
      # treated separately
# }

Run the code above in your browser using DataLab