Skip to content

Latest commit

 

History

History
173 lines (120 loc) · 5.37 KB

README.md

File metadata and controls

173 lines (120 loc) · 5.37 KB

TeachStatsWithR

Materials for the MOSAIC "Teaching Statistics with R and RStudio"

Compiling

The content of each book is in a separate directory. That directory has a subdirectory, Master with a file Master-*.Rnw.

Each of the .Rnw files in the content directory can be compiled on it's own. Just "Knit HTML" in RStudio. This will create a PDF file.

To create the whole book, you need to recompile each .Rnw after setting a variable, notAsStandAlone=TRUE. The process is

require(knitr)
# Change to the directory, e.g. 'Starting'
setwd("Starting")  # go to your own directory
standAlone = TRUE
fnames <- list.files(pattern = "*.Rnw$")  # files to recompile
for (fnm in fnames) knit(fnm)

Outline

This project consists of several short books that are inter-related.

  1. Start Teaching with R Directory: Starting
  2. The Core of a Traditional Course Directory: Traditional
  3. Simulation-Based Inference Directory: Simulation
  4. Functions and Formulas Directory: Functions
  5. Teaching with Internet Services Directory: Internet
  6. Start with Modeling Directory: Modeling

APPENDICES

A. Style instructions for authors B. Possible additional topics

Outlines for the individual chapters are in the Outline.Rmd file in each directory.

Overview

Some general comments about the project as a whole.

Start Teaching with R: Outline

Random list of things to include:

  • RStudio introduction
  • Packages and why to use them
  • The mosaic package and others that we recommend
  • Minimal R reference
  • Rmd
  • Umbrella for other books
  • Error messages. Things to look for in error messages.
    • overwriting names
    • recycling vectors
    • factors and characters
  • Data
    • data()
    • Group data with Google forms
    • fetchData() and requesting a repository name
    • distributing other kinds of files, e.g. templates for .Rmd, scripts, ...
  • Style
    • Don't use one-letter names in your examples. Your students will pick this up and end up saying things like c = makeFun(x~x), which will mask base::c() and mess everything up until you remove(c)

R Core for a Traditional Course: Outline

Simulation-Based Inference: Outline

Functions and Formulas: Outline

Using Internet Services: Outline

Start Modeling Early: Outline

Appendix A: Style Instructions for Authors

Notes for the authors can be included using \authNote{A note to the authors.}

Processed notes for the authors can be hidden using \authNoted{A noted note to the authors.}

Some Style Guidelines

  1. R Code
    1. Use space after comma in argument lists
    2. No space around = in argument list
    3. Use space around operators, <- and ->
    4. Casual comments (no need for caps)
    5. When referring to functions in the text, add empty parens (e.g., data()) to make it clear that the object is a function.
  2. Exercises N.B. Some exercises are for instructors, not for students.
    1. Use \begin{problem} ... \end{problem} to define problems.
    2. Use \begin{solution} ... \end{solution} to define solutions.

This must be \emph{outside} the problem environment and before the definition of the next problem. Put it immediately after \end{problem} to avoid confusion.

  • Use \shipoutProblems to display all problems queued up since the last shipoutProblems.

  • Examples Put within \begin{example} and end{example}. We can tweak the formatting later.

  • Marginal Notes We can place some marginal notes with:

    • \InstructorNote{This is an instructor note.}
    • \FoodForThought{We can tweak the layout, color, size, etc. later. For now. I'm just using color to distinguish.}
    • \Caution{This is a caution}
  1. Variable names. Often it's nice to distinguish between anactual variable name and a word that might have a similar name, for instance between sex and sex. Use the \VN{sex} command to accomplish this.
  2. Model formulas. Use \model{A}{B+C} to generate A ~ B+C . Often, you may want to use variable names, for instance \model{\VN{height}}{\VN{age}+\VN{sex}} gives height ~ age + sex.

R-forge svn

The mosaic R-forge repository contains

  • The .Rnw files
  • The dependencies in bin/
  • LaTeX dependencies in inputs/
    • problems.sty (for problems and solutions)
    • authNote.sty (for author notes)
    • probstat.sty (for some prob/stat macros)
    • sfsect.sty (for san serif section title fonts)

You may need to set an environment variable to make LaTeX look here.

  • the cache/ and figures/ directories (so that make can be used without complaint), but not their contents, which are generated by sweave.
  • screenshots and other images not generated by sweave are in images/

Appendix B: Possible Additional Topics

Do we want to include any of these topics?

  • Fancier Lattice Graphics
  • Base Graphics
  • Making plots with ggplots2 Only if one of us knows or wants to learn this system.
  • Writing executable R scripts
  • R Infrastructure for Teaching Whatever of this we include might end up in the chapters rather than in an appendix.
  • Sharing in R Studio
  • Public Data
  • Google Data
  • Making Data Available Online
  • A Brief Tour of knitr and R-markdown
  • exams
  • Books
    • Our books
    • Chance et al (in progress)
    • Existing books that work well/poorly with R (and why)
  • Online materials