#' Make a table of pairwise feature differences based on group membership.
#' @description Given the relevant pairwise distances, compute change in every feature in a table. .
#' @param x A pairwise distance table, for instance generated by `get_pairwise_distance`.
#' @param y A table containing the features (as columns) that should be contrasted over time.
#' @return a `data.frame` with pairwise differences
#'
get_fw_diff <- function(x, y){
do.call(rbind, unname(c(y[,x[,"to"]] - y[,x[,"from"]])))
}
#' Make a table of pairwise feature differences based on group membership.
#' @description Given the relevant pairwise distances, compute change in every feature in a table. .
#' @param pw_dist A pairwise distance table, for instance generated by `get_pairwise_distance`.
#' @param f_table A table containing the features (as columns) that should be contrasted over time.
#' @return a `data.frame` with pairwise differences
#' @export
#'
get_fw_volatility <- function(pw_dist, f_table){
cbind(pw_dist[,c("from", "to")],
`colnames<-`(get_fw_diff(x = pw_dist, y = f_table), rownames(f_table)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.