Submit every similarly named elements of a list of vectors to a function in R
问题 Below, I'm wondering how to use BASE R function quantile() separately across elements in L that are named EFL and ESL ? Note: this is a toy example, L could contain any number of similarly named elements. foo <- function(X) { X <- as.matrix(X) tab <- table(row(X), factor(X, levels = sort(unique(as.vector(X))))) w <- diag(ncol(tab)) rosum <- rowSums(tab) obs_oc <- tab * (t(w %*% t(tab)) - 1) obs_c <- colSums(obs_oc) max_oc <- tab * (rosum - 1) max_c <- colSums(max_oc) SA <- obs_c / max_c h <-