[R-sig-teaching] workspace management
William Revelle
lists at revelle.net
Tue Nov 2 20:45:26 CET 2010
My solution is a bit different.
Most student oriented files are relatively small (less than 1 MB) and
can just be copied to the clipboard from their editor/spreadsheet
progam.
Most students know how to open excel or text files. I have them do
that and then just copy the data to the clipboard (from Excel or
OpenOffice or Word or their favorite text editor)
then,
my.data <- read.clipboard() #from the psych package
and their data are in a suitable format.
If they are copying from excel,
my.data <- read.clipboard.tab() #will read directly from an Excel file
my.data <- read.clipboard.csv() # will read from a file in comma
delimited form.
etc.
The one problem I have had doing this is some student's do not know
what the clipboard is!
Bill
At 1:44 PM -0400 11/2/10, Ralph O'Brien, PhD wrote:
>========================
>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 at gmail.com>wrote:
>
>> 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
>>
>
>
>
>--
>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]]
>
>_______________________________________________
>R-sig-teaching at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
More information about the R-sig-teaching
mailing list