========================
If you have a path with backslashes in the Windows clipboard you can
just do this:

myPath <- readClipboard()
setwd(myPath)

which eliminates the need for any conversion.
========================

But this is still Windows-centric functionality (not platform independent)
and it hides what dataset was in play (not a good programming practice in
the real world).

On Tue, Nov 2, 2010 at 1:24 PM, Gabor Grothendieck
<ggrothendieck@gmail.com>wrote:

> On Tue, Nov 2, 2010 at 12:51 PM, Ralph O'Brien, PhD
> <obrienralph@gmail.com> wrote:
> > A huge plus for R is that it runs nearly identically on all three major
> > platforms. There is every reason to make our teaching as
> > platform-independent as we can.
> >
> > The choose.dir() function is not found on the Mac release (I'm still at
> v.
> > 2.11.1), so I would advise against using it, especially since it is
> trivial
> > to teach and use code that is "plain vanilla."
> >
> > My scripts to students begin with something like:
> >
> > # Uncomment one of these path2data statements and
> > # insert your appropriate path specification.
> > # path2data <- "C:/EPBI431/datasets"   # Windows (convert to forward
> > slashes)
> >  # path2data <- "/Users/ralphobrien/AllDocs/teaching/EPBI431/datasets"
> #
> > Mac OS
> > setwd(path2data)
> >
> > Later, I might simply give them:
> >
> > # setwd("C:/EPBI431/datasets")  # Windows (convert to forward slashes)
> > # setwd("/Users/ralphobrien/AllDocs/teaching/EPBI431/datasets")  # Mac OS
> >
> > Some students have never encountered path specifications, so when I
> > introduce this, I show them how to use "Properties" (Windows XP) and "Get
> > Info" (Mac OS) to copy-paste what is needed, converting the back slashes
> to
> > forward slashes for Windows.
>
> If you have a path with backslashes in the Windows clipboard you can
> just do this:
>
> myPath <- readClipboard()
> setwd(myPath)
>
> which eliminates the need for any conversion.
>
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>



-- 
Ralph O'Brien, PhD
Professor, Dept of Epidemiology and Biostatistics
Case Western Reserve University
Office: 216.368.1927
Cell: 216.312.3203

	[[alternative HTML version deleted]]


