[R] add specific fields in for loop

Kai Yang y@ngk@|9999 @end|ng |rom y@hoo@com
Tue Nov 15 17:18:27 CET 2022


Hi Team,
I can write a for loop like this:
for (i in columns(df)){
  ......
}

But it will working on all column in dataframe df. If I want to work on some of specific fields (say: the fields' name content 'date'), how should I modify the for loop? I changed the code below, but it doesn't work.
for (i in columns(df) %in% 'date' ){
  .....
}


Thank you,
Kai

	[[alternative HTML version deleted]]



More information about the R-help mailing list