I'd like to change the values in a data.frame that match a criteria, but I'd like to specify the criteria only applies to certain columns. I'm aware about:
- Being df = Dataframe: df[df < 0] = 0. This applies to all elements in all the columns, so that, this not resolve my problem
- Being df = Dataframe and Col: a dataframe's column: df$Col[df$Col < 0] = 0.This applies to all elements in 1 column, so that, this not resolve my problem neither.
Which is the solution in the middle that allows me to filter all elements for those specified columns that I define?