I am trying to exclude all combinations generated by combn function that consists of "var4" and "var5". Here below is the code that does not work at the moment:
mod_headers <- c("var1", "var2", "var3", "var4", "var5", "var6")
f <- function(){
for(i in 1:length(mod_headers)){
tab <- combn(mod_headers,i,function(mod_headers){
if (combn(mod_headers,i) %in% c("var4","var5")) {return()}
})
for(j in 1:ncol(tab)){
tab_new <- c(tab[,j])
mod_tab_new <- c(tab_new, "newcol")
print(mod_tab_new)
}
}
}
f()
Thanks for your help!