Less Volume, More Creativity

R Pruim
2014 iCOTS Workshop

A note about my slides

The new support for documentation creation in RStudio is great.

  • These slides are HTML, but I created them in RMarkdown (+ a little bit of HTML fiddling)

  • Other slides will be PDF created using beamer – but again, I wrote them in RMarkdown

  • A single RMarkdown file can generate PDF, HTML, or Word

    • no need to know HTML, LateX or Word
    • but if you do, you can take advantage

Less Volume, More Creativity

A lot of times you end up putting in a lot more volume, because you are teaching fundamentals and you are teaching concepts that you need to put in, but you may not necessarily use because they are building blocks for other concepts and variations that will come off of that … In the offseason you have a chance to take a step back and tailor it more specifically towards your team and towards your players.“

Mike McCarthy, Head Coach, Green Bay Packers

SIBKIS: See It Big, Keep It Simple

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.

— Antoine de Saint-Exupery (writer, poet, pioneering aviator)

Less Volume, More Creativity

One key to successfully introducing R is finding a set of commands that is

  • small: fewer is better
  • coherent: commands should be as similar as possible
  • powerful: can do what needs doing

It is not enough to use R, it must be used elegantly.

Two examples of this principle:

  • the mosaic package
  • the dplyr package (Hadley Wickham)

Minimal R

Goal: a minimal set of R commands for Intro Stats

Result: Minimal R Vignette

Much of the work on the mosaic package has been motivated by

  • The Less Volume, More Creativity approach
  • The Minimal R goal

A few little details

R is case sensitive

  • many students are not case sensitive

Arrows and Tab

  • up/down arrows scroll through history
  • TAB completion can simplify typing

If all else fails, try ESC

  • If you see a + prompt, it means R is waiting for more input
  • If this is unintentional, you probably have a typo
  • ESC will get you pack to the command prompt

The Most Important Template

 

goal ( yyy ~ xxx , data = mydata )

 

The Most Important Template

 

goal (  y  ~  x  , data = mydata )

The Most Important Template

 

goal (  y  ~  x  , data = mydata , …)

 

Other versions:

# simpler version
goal( ~ x, data = mydata )          
# fancier version
goal( y ~ x | z , data = mydata )   
# unified version
goal( formula , data = mydata )     

2 Questions

 

goal (  y  ~  x  , data = mydata )

 

What do you want R to do? (goal)

 

What must R know to do that?

2 Questions

 

goal (  y  ~  x  , data = mydata )

 

What do you want R to do? (goal)

  • This determines the function to use

What must R know to do that?

  • This determines the inputs to the function
  • Must identify the variables and data frame

How do we make this plot?

plot of chunk unnamed-chunk-4

How do we make this plot?

plot of chunk unnamed-chunk-5

What is the Goal?

What does R need to know?

How do we make this plot?