Very simple problem I'm trying to solve, just can't seem to figure it out. I want to apply a certain criteria which is in a column to a number of columns.
cols_to_change<-['d','e','f']
for one column, d, i can do this:
df$d[which(df$criteria<df$d)]<-NA
But for the other columns,e,f, I could do a for loop, but I wanted to use an apply function instead. How can I do this?