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.

In the real world, there are also strong programming integrity reasons to
hard code paths directly into our scripts. This leaves no doubt about what
dataset was being analyzed, etc.

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




On Mon, Nov 1, 2010 at 9:09 PM, Murray Jorgensen <maj@waikato.ac.nz> wrote:

> I think that folders should be organized by topic and not by the software
> that might use the files. After all you might want to use several different
> applications of files in a folder.
>
> I teach doing something like this at the start of an R script:
>
> > wdir <- choose.dir()
> > wdir
> [1] "C:\\Files\\Teaching\\STAT321\\2008"
> > setwd(wdir)
>
> Later you can edit this to
>
> wdir <- # choose.dir()
>       "C:\\Files\\Teaching\\STAT321\\2008"
> setwd(wdir)
>
> to avoid repeating the dialog boxes.
>
> Murray
>
>
> On 2/11/2010 10:32 a.m., Laura Chihara wrote:
>
>> hello!
>>
>> I'm wondering how you have your students
>> handle workspaces in R. Do you have students
>> create their own R folder (on their home drive),
>> and then load from within R? Or do you
>> have them create an R shortcut and then
>> type the path in the "Start In" field (Windows)?
>>
>> I've been teaching the latter method, but am
>> wondering if loading from within R is easier?
>>
>> Thanks for ideas.
>>
>> --Laura
>>
>> *******************************************
>> Laura Chihara
>> Professor of Mathematics 507-222-4065 (office)
>> Dept of Mathematics 507-222-4312 (fax)
>> Carleton College
>> 1 North College Street
>> Northfield MN 55057
>>
>> _______________________________________________
>> R-sig-teaching@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
>>
>
> --
> Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
> Department of Statistics, University of Waikato, Hamilton, New Zealand
> Email: maj@waikato.ac.nz                                Fax 7 838 4155
> Phone  +64 7 838 4773 wk    Home +64 7 825 0441   Mobile 021 0200 8350
>
> _______________________________________________
> R-sig-teaching@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
>

	[[alternative HTML version deleted]]


