Every course we teach has logistics. The way we handle logistics has changed over time.
- Lecture / blackboard for broadcasting information
- Mimeograph -> Photocopy for providing a syllabus, etc.
- Floppy disks, “H: drive” for distributing files
- Computer lab machines -> student-owned laptops
- Links to HTML files
- Course specific web sites
- Course support software (e.g. Moodle)
Many old-time techniques are still good, but some of them are not well suited to teaching with computation and not well integrated with R.
Here are some basic areas needed for just about every R-based class.
- Providing R
- Distributing data files
- Distributing class notes
- Distributing R commands
These same areas apply to other software: JMP, Python, Matlab, Mathematica, etc.
- Install R/RStudio on lab machines
- Install R/RStudio on student machines
- Use an R/RStudio server
Many beginning students: Use a server
Every student has a Facebook account, so they already have access to the hardware they need.
- No student set up
- Everyone has exactly the same interface
- Dogs can’t possible eat their computer.
- Students can share their account with you — you can see what’s wrong to help them.
- Update of version and packages is centralized
- Possible load problems
- Hundreds of students simultaneously in class
- Thousands of students asynchronously
- Working with your IT Department. Some are great, others have limited resources.
- Work-around, as necessary. A server can be set up on the Cloud, e.g. Amazon Web Services. Good documentation of process for sys-admins.
Distributing Data Files
- Students download files and use basic R functions to read them in, e.g.
Give students links to data files on web server. Again, use the basic R functions, e.g.
- Functions for reading in files with short names, e.g.
- Existing packages, e.g.
Shared, editable files (e.g. for group projects)
and even …
- Your own package for your own course.
Students Download Files
- Students may not put files where they should.
- Uploading files to RStudio Server can be confusing. Students don’t understand that the server is another machine running another operating system.
- Students will use the wrong R function.
- Updating is a nightmare.
Links to Data Files on Web Server
Of course, that’s how you would distribute files for download.
Rather than posting a link to the file, post the command for reading in the file to the current data session.
todaysData <- read.csv(file="http://dl.dropboxusercontent.com/u/5098197/StatisticalModeling/mydata1.csv")
Students cut-and-paste the command from course web site to their R session.
Make sure the protocol is
Use tinyurl.com` to translate your long URL to a short one.
## Complete file name given. No searching necessary.
## Who Age
## 1 Bill 3
## 2 Charley 4
## 3 Debby 5
- Easy to find, use, and to update data.
- Posting command minimizes possibilities for typing mistakes.
- Many datasets already on book sites, e.g. Lock^5
Functions for reading in files with short names
Set up a web repository for files. Write a function that looks up short names on that repository.
G <- mosaic::fetchData("Dome.csv")
## Retrieving from http://www.mosaic-web.org/go/datasets/Dome.csv
- Easy to use new data sets in class: one step process
- Writing such a function is not trivial for newbies
mosaic::fetchData() doesn’t automatically connect to your repository, just the
Packages are the standard way for distributing R software. They also provide facilities for data, for notes, and for Rmd templates.
The data set you want to use may already exist in a CRAN or other package.
Command to access the data:
- Loaded packages : e.g.
data(Galton) or sometimes just
- Installed but unloaded packages:
Finding the data you want:
Look at packages on CRAN etc. Get list by naming the package, e.g.
There are thousands of datasets available.
Distributing Class Notes
Use R/Markdown to write notes.
- Publish the notes to Rpubs.com and post link on your website
- Keep the html files on your web server.
Even better: Keep the sources there so that the notes will be updated automatically when you change them. Even better: Keep your RStudio Project on the web server.
- Use an RStudio project linked to GitHub. This is very powerful, but has a steep learning curve.
Distributing R Commands
Suggestion: Use R Markdown and distribute the commands just like your class notes. Give a link to the
Have students copy and paste from their browser into the RStudio editor, and use “Chunks/Run All”. That will source the code.
RStudio has “templates.” These are currently distributed from packages.