library(tidyverse)
As long as Momocs2 API is not considered stable, this is more a notebook for what is intended, not for what works fine.
method <- function(x, more_args, from_col, to_col, drop_coo, ...){ UseMethod("method") } method.default <- function(x, ...){ not_defined("method") } method.coo_single <- function(x, more_args, ...){ # here goes the calculation # that ends with ... %>% coe_single() %>% .append_class("method_single") } method.coo_list <- function(x, more_args, ...){ # something on the lines of x %>% purrr::map(method, more_args) %>% coe_list() %>% .append_class("method_list") } method.mom_tbl <- function(x, more_args, from_col, to_col, drop_coo=TRUE, ...){ # tidyeval from_col <- enquo(from_col) to_col <- enquo(to_col) res <- dplyr::pull(x, !!from_col) %>% method(more_args) res <- dplyr::mutate(x, !!to_col := res) if (drop_coo) res <- dplyr::select(res, -(!!from_col)) res }
In Momocs2 their names follow this pattern: method_cal_flavour
, eg efourier_cal_harmonicpower
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.