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

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Apr 8 20:23:30 CEST 2014


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




More information about the R-help mailing list