0

How can I iterate over a list containing a subset of the columns in my dataframe?

Example:

df columns = a,b,c,d,e

my_list <- c("a","b","c")

If I try:

for (i in my_list){
   print(df$i)  
}

I obtain as many NULL as there are values in my_list. I need to solve this problem in order to apply some changes to the dataframe columns present in my_list.

camille
  • 16,432
  • 18
  • 38
  • 60

0 Answers0