This may seem like a simple problem to solve, but it's beyond me. I have the following enclosed string
'{"foo":"bar","x":"<SOME VAR>"}'
I want to pass a variable into the place of <SOME VAR>. What would be the best way to achieve this? Any help is greatly appreciated.
gsub?string_name <- gsub(pattern = "<SOME VAR>", replacement = variable, x = string_name)where string_name is the name of your example stringy <- 25; paste0('{"foo":"bar","x":"', y, '"}').