[R] Creating/Reading a complex string in R

Richard M. Heiberger rmh at temple.edu
Tue Jul 18 18:57:26 CEST 2017


your string opens with single quote ', and has a single quote ' in the middle.
R sees that as the end of the string.  You will need to escape the
interior ' with
\'
See ?Quotes
for details.


On Tue, Jul 18, 2017 at 12:48 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
> Hi again,
>
> Let say I have below string (arbitrary)
>
> <html>
>   <head>
>     <script type="text/javascript"     <script type="text/javascript">
>       mystatement('current', {'pac':['']});
>       mystatement;
>
>
> I want to pass above string to some R variable for further analysis.
> So I have tried below :
>
> String = '<html>
>   <head>
>     <script type="text/javascript"     <script type="text/javascript">
>       mystatement('current', {'pac':['']});
>       mystatement;'
>
> It is not clearly working as I am getting below error :
>
>> String = '<html>
>
> +   <head>
>
> +     <script type="text/javascript"     <script type="text/javascript">
>
> +       mystatement('current', {'pac':['']});
>
> Error: unexpected symbol in:
>
> "    <script type="text/javascript"     <script type="text/javascript">
>
>       mystatement('current"
>
>>       mystatement;'
>
> Error: object 'mystatement' not found
>
>>
>
>
> Any pointer how to create my string 'String' based on above would be
> highly appreciated.
>
> Thanks for your time.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list