# Title : TensorsGLMM.R
# Objective : Building tensors
# Created by: greyhypotheses
# Created on: 31/03/2022
#'
#' @param frame
#' @param field
#' @param FUN
#'
TensorsGLMM <- function (frame, field, FUN) {
x <- lapply(X = frame[, field], FUN = FUN)
x <- dplyr::bind_cols(x)
x[lower.tri(x, diag = FALSE)] <- NA
x <- cbind(index = seq_len(nrow(x)), item = frame[, field], x)
x <- rbind(c(0, 0, frame[, field]), x)
colnames(x = x) <- c('index', field, seq_len(nrow(frame)))
return(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.