Learn R Programming

Momocs (version 1.2.9)

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, rescale, rm_harm, rm_uncomplete, rw_fac, sample_frac, sample_n, select, slice

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
      lapply(npoly) %>% # separately apply npoly
      combine %>%       # recombine
      PCA %>% plot      # an illustration of the 2 views
      # treated separately
# }

Run the code above in your browser using DataLab