Re: [R] Creating/Reading a complex string in R

2017-07-19 Thread Duncan Murdoch
On 19/07/2017 11:41 AM, Jeff Newmiller wrote: I think the whole premise of this question is flawed. If you want to work with this string as data, then read it in from a separate file using readLines. If it is fixed data that you want to be part of your program, then invest the effort to escap

Re: [R] Creating/Reading a complex string in R

2017-07-19 Thread Jeff Newmiller
I think the whole premise of this question is flawed. If you want to work with this string as data, then read it in from a separate file using readLines. If it is fixed data that you want to be part of your program, then invest the effort to escape the odd characters and be done with it. But us

Re: [R] Creating/Reading a complex string in R

2017-07-19 Thread David Winsemius
> On Jul 19, 2017, at 5:38 AM, Michael Friendly wrote: > > It was suggested to quote your string with *backticks* (` ... `) rather than > single quotes. > > String <- ` > > ... > ` That failed for me. The parser considered it a language object, an R name. Here's what I needed to do:

Re: [R] Creating/Reading a complex string in R

2017-07-19 Thread Michael Friendly
It was suggested to quote your string with *backticks* (` ... `) rather than single quotes. String <- ` ... ` On 7/18/2017 1:05 PM, Christofer Bogaso wrote: Thanks for your pointer. Is there any way in R how to replace " ' " with " /' " programmatically? My actual string is quite

Re: [R] Creating/Reading a complex string in R

2017-07-18 Thread Olivier Crouzet
On Tue, 18 Jul 2017 22:35:17 +0530 Christofer Bogaso wrote: > Thanks for your pointer. > > Is there any way in R how to replace " ' " with " /' " > programmatically? > Hi, perhaps you should simply read the content of a corresponding text file? There's a simple way using the readr package. Us

Re: [R] Creating/Reading a complex string in R

2017-07-18 Thread John McKown
On Tue, Jul 18, 2017 at 12:05 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Thanks for your pointer. > > Is there any way in R how to replace " ' " with " /' " programmatically? > > My actual string is quite lengthy, so changing it manually may not be > possible. I am aware of gsub

Re: [R] Creating/Reading a complex string in R

2017-07-18 Thread Christofer Bogaso
Thanks for your pointer. Is there any way in R how to replace " ' " with " /' " programmatically? My actual string is quite lengthy, so changing it manually may not be possible. I am aware of gsub() function, however not sure I can apply it directly on my original string. Regards, On Tue, Jul 1

Re: [R] Creating/Reading a complex string in R

2017-07-18 Thread John McKown
Try: String = '

Re: [R] Creating/Reading a complex string in R

2017-07-18 Thread Richard M. Heiberger
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 wrote: > Hi again, > > Let say I have below string (ar

[R] Creating/Reading a complex string in R

2017-07-18 Thread Christofer Bogaso
Hi again, Let say I have below string (arbitrary)