I have this dataframe:
df <- data.frame(
ID = c("1", "2", "3"),
option_json = c('{"thickness":"0.031 inches","tensile strength":"600 lb","size":"0.5 Inches x 7200 Feet"}', '{"thickness":"0.031 inches","tensile strength":"600 lb","size":"0.5 Inches x 7200 Feet"}' , '{"tensile strength":"600 lb","color":"Black","size":"0.5 Inches x 7200 Feet"}'))
ID option_json
1 1 {"thickness":"0.031 inches","tensile strength":"600 lb","size":"0.5 Inches x 7200 Feet"}
2 2 {"thickness":"0.031 inches","tensile strength":"600 lb","size":"0.5 Inches x 7200 Feet"}
3 3 {"tensile strength":"600 lb","color":"Black","size":"0.5 Inches x 7200 Feet"}
I want this dataframe:
ID option_json
1 1 {"thickness":"0.031\"","tensile strength":"600 lb","size":"0.5\" x 7200'"}
2 2 {"thickness":"0.031\"","tensile strength":"600 lb","size":"0.5\" x 7200'"}
3 3 {"tensile strength":"600 lb","color":"Black","size":"0.5\" x 7200'"}
I tried using str_replace and gsub to replace the inches but I keep getting double backslashes behind the double quote. Not sure how to just string replace with just a single backslash.