I have the following data.table with two columns;
library(data.table)
dt1 <- as.data.table(data.frame(
relative.1 = c("up", "down", "up", "down", "down",
"up", "up", "up", "down", "down"),
color.1 = c(
"<span style= color: red !important; >0.00239377213823793</span>",
"<span style= color: red !important; >0.0189475913373258</span>",
"<span style= color: red !important; >0.000944874682014027</span>",
"<span style= color: red !important; >0.00115563834695583</span>",
"<span style= color: red !important; >0.00190146895689528</span>",
"<span style= color: red !important; >0.00905363339565874</span>",
"<span style= color: red !important; >0.00786719465124788</span>",
"<span style= color: red !important; >0.0021806607355806</span>",
"<span style= color: black !important; >0.0677967189492317</span>",
"<span style= color: black !important; >0.0643565809998716</span>"
), stringsAsFactors = FALSE))
I would like to replace numeric characters within ">" and "<" with a string in corresponding row of the column, "relative.1". For example, in the first row, I'd like to replace "0.00239377213823793" with "up".
I'd appreciate any pointers.