Resolved: How to have a list iterate the name of a variable as it runs through a loop

In this post, we will see how to resolve How to have a list iterate the name of a variable as it runs through a loop

Question:

thank you for your time!
I am trying to run a chi-squared test through each of the variables in my dataset, and I am executing it with a loop that runs through a list. However, I am trying to figure out the syntax to make the loop print the variable name as it iterates through. Here is my code

Best Answer:

Create a vector of column names and then loop over the column names

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com