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
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.