[R-sig-teaching] workspace management
Gabor Grothendieck
ggrothendieck at gmail.com
Tue Nov 2 18:24:44 CET 2010
On Tue, Nov 2, 2010 at 12:51 PM, Ralph O'Brien, PhD
<obrienralph at 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
More information about the R-sig-teaching
mailing list