I have a data frame (150000 obs, 15 variables) in R and need to correct a subset of values of one variable (simply by multiplying by a constant) based on the value of another. What's an easy way to do this?
I though apply would work, but I'm not sure how to write the function (obviously can't multiply in the function) and qualifier:
df$RESULT <- df[apply(df$RESULT, 1, function(x * 18.01420678) where(SITE==1)), ]