That is not what I meant by posting a reproducible example, the example data you have posted is not even copy/paste friendly, for future posts, I strongly encourage you to read the guide in the link I gave you, and at least try to provide a proper reproducible example. Since you are new here, this time I'm going to make the extra effort of parsing some sample data from the table you have posted. This is what I think you are trying to achieve.
library(dplyr)
# Sample data on a copy/paste friendly format, replace this with your own data frame
sample_df <- data.frame(
stringsAsFactors = FALSE,
wbid = c("2749A_21FLA","2749A_21FLA",
"2749A_21FLA","2749A_21FLA","2749A_21FLA","2749A_21FLA"),
STA = c(20020137,20020137,20020137,
20020137,20020137,20020137),
year = c(2014, 2014, 2014, 2014, 2014, 2014),
month = c(7, 7, 7, 7, 7, 7),
day = c(1, 1, 1, 1, 1, 1),
time = c(1125, 1125, 1125, 1125, 1125, 1125),
depth = c(0.3, 0.3, 0.3, 0.3, 0.3, 0.3),
param = c(410, 32209, 80, 600, 665, 49901),
mastercode = c("ALK", "CHLAC", "COLOR", "TN", "TP", "TSS"),
result = c(26, 2.3, 240, 1.704, 0.17, 2),
rcode = c(NA, NA, NA, "+", NA, "I"),
xcode = c(NA, NA, "U", NA, NA, "I")
)
# Relevant code
sample_df %>%
mutate(result = if_else((rcode %in% "U" | xcode %in% "U"),
(result*2)/sqrt(2),
result))
#> wbid STA year month day time depth param mastercode result
#> 1 2749A_21FLA 20020137 2014 7 1 1125 0.3 410 ALK 26.0000
#> 2 2749A_21FLA 20020137 2014 7 1 1125 0.3 32209 CHLAC 2.3000
#> 3 2749A_21FLA 20020137 2014 7 1 1125 0.3 80 COLOR 339.4113
#> 4 2749A_21FLA 20020137 2014 7 1 1125 0.3 600 TN 1.7040
#> 5 2749A_21FLA 20020137 2014 7 1 1125 0.3 665 TP 0.1700
#> 6 2749A_21FLA 20020137 2014 7 1 1125 0.3 49901 TSS 2.0000
#> rcode xcode
#> 1 <NA> <NA>
#> 2 <NA> <NA>
#> 3 <NA> U
#> 4 + <NA>
#> 5 <NA> <NA>
#> 6 I I
Created on 2022-06-23 by the reprex package (v2.0.1)