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

Jonathan Greenberg jgrn at illinois.edu
Tue Apr 8 17:00:03 CEST 2014


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