I have a vector of column names that I pulled from a data frame:
x = names(myDataSet)
I want to build tables for data exploration by passing each column name into a for loop and generate each table against a specific named column 'verdict' separately. I have tried the following:
for (i in x){
table(myDataSet$i, myDataSet$verdict)
}
and
for (i in x){
table(myDataSet[[i]], myDataSet$verdict)
}
But nothing has worked. Any suggestions?