I have a dataframe in R looking like this:
... vals cat ...
1.2 TRUE
1.6 FALSE
5 TRUE
I like to modify the values in the “vals” column depending on if the factor in the cat
column is TRUE or false. Lets say I want to multiply the value in the vals column
with a factor (e.g 9) when the category of the same row says TRUE.
As result I would like to
have a copy of the original dataframe but with the modified values instead. Or a dataframe with one more column containing the original values if unmodified (FALSE) and the modified if cat
was TRUE.
Hope somebody could
give me a hand with this.
Best Regards Sab.
1 Answer