Apologies if this question is too easy, I know how to do it in Python but I currently need it in R.
As part of an SQL query I get a variable with some numbers (the lengt
You can try using gsub to first replace { and } and then split in vector using strsplit. Finally, convert it to numeric as:
gsub
{
}
strsplit
x <- "{0.5,0.25,0.75,0.5}" as.numeric(strsplit(gsub("[{}]","",x), split = ",")[[1]]) #[1] 0.50 0.25 0.75 0.50