0

I have a dataframe called my_data. I have 47 columns. I want to loop through all columns starting on the third column. I then want to change each of these columns to a factor using the original column header.

I am fairly new to coding in R, and I appreciate the help! I am unsure of the correct syntax but here is my code;

  for(i in names(my_data)){
  my_data$[i] <- factor(my_data$[i])
  is.factor(my_data$[i])
}
Dustin Smith
  • 115
  • 1
  • 6

0 Answers0