Reputation: 122
I have a string:
"list(id = '1001', status = c('xyz', 'abc', 'def', 'jkl'))"
I want to convert it to:
list(id = '1001', status = c('xyz', 'abc', 'def', 'jkl'))
Any help would be greatly appreciated.
Upvotes: 1
Views: 37
Reputation: 886938
We can just do eval(parse
out <- eval(parse(text = "list(id = '1001', status = c('xyz', 'abc', 'def', 'jkl'))"))
-output
out
$id
[1] "1001"
$status
[1] "xyz" "abc" "def" "jkl"
With dput
, can get the structure
dput(out)
list(id = "1001", status = c("xyz", "abc", "def", "jkl"))
Upvotes: 2