[Solved] multiply multiple column and find sum of each column for multiple values
Try this: df <- read.table(text = “v1 v2 v3 v4 v5 0 1 1 1 1 0 1 1 0 1 1 0 1 1 0”, skip = 1) df ll <- vector(mode = “list”, length = ncol(df)-1) ll <- lapply(2:ncol(df), function(ncols){ tmp <- t(apply(df, 1, function(rows) combn(x = rows, m = ncols, prod))) if(ncols … Read more