[R] quotation marks and scan

Rolf Turner r.turner at auckland.ac.nz
Sun Nov 17 23:38:30 CET 2013

(1) The backslashes are not really there; they are an artefact of the R 
print() function.
Try cat(u,"\n").  I think this might be an FAQ.

(2) Is not your problem the fact that your are setting "replacement" 
equal to the
thing you are trying to get rid of?  I.e. don't you want

     v <- gsub(pattern='\"',replacement='',x=u)     ???

Either I am misunderstanding your intent or you need another cup of coffee.



On 11/18/13 11:07, Erin Hodgess wrote:
> Dear R People:
> I'm sure that this is a very simple problem, but I have been wresting with
> it for some time.
> I have the following file that has the following one line:
>   CRS("+init=epsg:28992")
> Fair enough.  I scan it into R and get the following:
>> u
> [1] "CRS(\"+init=epsg:28992\")"
>> gsub(pattern='\"',replacement='"',x=u)
> [1] "CRS(\"+init=epsg:28992\")"
> I need to get rid of the extra quotation marks and slashes.  I've tried all
> sorts of things, including gsub, as you see,  but no good.

More information about the R-help mailing list