I think I need to write an if/else loop of some kind to accomplish this, but I'm not sure where to start. I want to search within a column of my data frame for values that are of a certain length, and contain a certain symbol. For example, within the column LAYER, if the value is two symbols long and contains an "L" (this could be LF, FL, LH, or HL), I want to multiply other column values by 0.5.
LAYER VALUE UPPER LOWER THICKNESS_MIN THICKNESS_MAX A1 A2 A3
LF 5 0 4 3 10 3.4 67 24
LFH 9 0 6 2 9 3.7 65 76
FH 4 0 2 1 8 3.3 35 34
FL 11 0 1 5 6 3.8 56 86
LH 50 0 4 3 4 4.6 43 45
The sentence format that I have for this is "#if value in LAYER is 2 characters and one of them is L, then multiply the columns VALUE, UPPER, LOWER, THICKNESS_MIN AND THICKNESS_MAX by 1/2 and change the LAYER value to FF_FH for this row
I also need to do the same but for rows where the LAYER value is 3 characters long, and the other variables are multiplied by 2/3.
I want the final outcome to be something like
LAYER VALUE UPPER LOWER THICKNESS_MIN THICKNESS_MAX A1 A2 A3
LF 2.5 0 2 1.5 5 3.4 67 24
LFH 3 0 2 1.3 3 3.7 65 76
FH 4 0 2 1 8 3.3 35 34
FL 5.5 0 0.5 2.5 3 3.8 56 86
LH 25 0 2 1.5 2 4.6 43 45