string <- "\"sidewalk\"=>\"none\""
print(string, quote = FALSE)
#> [1] "sidewalk"=>"none"
read.table(
text = gsub(',?([^,]+)=>',"\n\\1:", string, perl = TRUE),
sep = ":",
col.names = c("key", "value")
)
#> key value
#> 1 sidewalk none
string <- "\"maxwidth\"=>\"6'6\\\"\",\"sidewalk\"=>\"none\""
print(string, quote = FALSE)
#> [1] "maxwidth"=>"6'6\\"","sidewalk"=>"none"
read.table(
text = gsub(',?([^,]+)=>',"\n\\1:", string, perl = TRUE),
sep = ":",
col.names = c("key", "value")
)
#> Error in read.table(text = gsub(",?([^,]+)=>", "\n\\1:", string, perl = TRUE), : incomplete final line found by readTableHeader on 'text'
Created on 2021-05-18 by the reprex package (v2.0.0)