Thanks,
That jogged my my brain.
Then, I realized that I really want to parse this.
>
"\"c(list(\"c('a','b'),c('c','d'))\")\""
[1]
"\"c(list(\"c('a','b'),c('c','d'))\")\""
Then, I remembered that parse() has an opposite: deparse().
So I started to work backwards.
I ended up with this.
>
deparse(deparse("\"c(list(\"c('a','b'),c('c','d'))\")\""))
[1]
"\"\\\"\\\\\\\"c(list(\\\\\\\"c('a','b'),c('c','d'))\\\\\\\")\\\\\\\"\\\"\""
That is too hot to handle.
I will re-start programming in a different direction.
But, again, thanks for the help.
Andre Mikulec
Andre_Mikulec at Hotmail.com
----------------------------------------> Subject: Re: [R] How do I parse embedded quotes?
> To: andre_mikulec at hotmail.com; r-help at r-project.org
> From: murdoch.duncan at gmail.com
> Date: Tue, 26 Jan 2016 12:29:27 -0500
>
> On 26/01/2016 10:44 AM, Andre Mikulec wrote:
>> I want embedded quotes to be parsed. I can not figure out hot to do
that. I want to this to be parsable.
>>
>> "'"a"'"
>>
>> In a simpler case, "'a'" is parsable.
>>
>>> eval(parse(text="\"'a'\""))
>> [1] "'a'"
>>
>>
>> But I want to parse embedded quotes
>> So, I want to parse '"a"' and not just 'a'
>>
>>>
eval(parse(text="\"'\"a\"'\""))
>> Error in parse(text =
"\"'\"a\"'\"") : <text>:1:4:
unexpected symbol
>> 1: "'"a
>>
>>
>> I keep getting that(above) error.
>> Any ideas would much be appreciated.
>
> It is usually helpful to print strings using cat(), so that the escapes
> and quotes around it don't show. With your string that gives the
> error, I see
>
> "'"a"'"
>
> That's not legal R source, because the double quotes that are within
the
> string are not escaped. To be legal R code you would need
>
> "'\"a\"'"
>
> and to get that you need the original string to look like
>
> "\"'\\\"a\\\"'\""
>
> Duncan Murdoch