[R] Ignore escape characters in a string...

Jonathan Greenberg jgrn at illinois.edu
Wed Apr 9 18:32:34 CEST 2014


Thanks all, I'll try some of these suggestions out but it seems like a
raw string ability could come in helpful -- there aren't any packages
out there that have this capability?

--j

On Tue, Apr 8, 2014 at 1:23 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
> What is wrong with
>
> winpath <- readLines("clipboard ")
>
> ?
>
> If you want to show that as a literal in your code, then don't bother assigning it to a variable, but let it echo to output and copy THAT and put it in your source code.
>
> There is also file.choose()...
>
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On April 8, 2014 8:00:03 AM PDT, Jonathan Greenberg <jgrn at illinois.edu> wrote:
>>R-helpers:
>>
>>One of the minor irritations I have is copying paths from Windows
>>explorer, which look like:
>>
>>C:\Program Files\R\R-3.0.3
>>
>>and using them in a setwd() statement, since the "\" is, of course,
>>interpreted as an escape character.  I have to, at present, manually
>>add in the double slashes or reverse them.
>>
>>So, I'd like to write a quick function that takes this path:
>>
>>winpath <- "C:\Program Files\R\R-3.0.3"
>>
>>and converts it to a ready-to-go R path -- is there a way to have R
>>IGNORE escape characters in a character vector?
>>
>>Alternatively, is there some trick to using a copy/paste from Windows
>>explorer I'm not aware of?
>>
>>--j
>



-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
259 Computing Applications Building, MC-150
605 East Springfield Avenue
Champaign, IL  61820-6371
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007




More information about the R-help mailing list