[R] quotation marks and scan

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Sun Nov 17 23:42:44 CET 2013


They're not actually there so don't try too hard to rid yourself of them:

x <- "\'"

length(x)
print(x)
cat(x, "\n")

Make sure you're clear on the difference between what's stored by the computer and what it print()s. Rarely the same, though cat() is often slightly more honest. 

On Nov 17, 2013, at 17:07, Erin Hodgess <erinm.hodgess at gmail.com> 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.
> 
> Thank you for any help.
> 
> Sincerely,
> Erin
> 
> 
> -- 
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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