R - The answer to your wildest data dreams

Or, how I learned to stop worrying and love R

Nathaniel Phillips, University of Basel
PsyKo 2017, Bern

Goal

There is exactly one goal in this workshop

Get you excited about learning R!

plot of chunk unnamed-chunk-1

My R Journey

  • 5 years struggling with SPSS

plot of chunk unnamed-chunk-2

  • Never quite did what I wanted.
  • Never could replicate my analyses
  • Didn't know how to do anything else
  • 5 years of glorious R.

plot of chunk unnamed-chunk-3

  • The first few months were tough
  • I discovered new things every day (and still am)
  • Pretty soon, I could reproduce 6 months of SPSS analyses in an afternoon.

So you want to become a song writer

plot of chunk unnamed-chunk-4

Two ways to learn to play songs....

ChordBuddy

plot of chunk unnamed-chunk-5

Fingers

plot of chunk unnamed-chunk-6

R has a learning curve...but it's worth it!

plot of chunk unnamed-chunk-7

R has a learning curve...but it's worth it!

plot of chunk unnamed-chunk-8

10 reasons why R is so great

plot of chunk unnamed-chunk-9

Reason 1. Free and open source

  • Because R is free and open source, you can always get access to R (unlike SPSS and MatLab)

"To be able to choose between proprietary software packages is to be able to choose your master. Freedom means not having a master. And in the area of computing, freedom means not using proprietary software." -- Richard M. Stallman


"Closed source software [like SPSS and MatLab] is useless crap because it satisfies neither repeatability nor inspectability" -- Titus Brown

plot of chunk unnamed-chunk-11

plot of chunk unnamed-chunk-12

Reason 2: Statistics

Of course, R has all of the statistical analyes you could possibly want

Basics

  • Hypothesis tests: t.test(), cor.test(), chisq.test()
  • Regression, ANOVA: lm(), anova()

Advanced

  • Bayesian Statistics: ttestBF(), anovaBF(), lmBF()
  • Heirarchical models: lmer()
  • Factor analysis: factanal()

plot of chunk unnamed-chunk-13

Reason 3. Access to the latest, greatest

  • Because it's open source, there is a huge community of R developers.
  • If someone comes up with something cool, they will share it and you'll get immediate access.

plot of chunk unnamed-chunk-15

plot of chunk unnamed-chunk-16

Reason 4: Plotting

  • Graphics are like designer cars, when it's made by a great manufacturer (like R), you can see it. When it's made cheaply, (like SPSS), you can see that too.

plot of chunk unnamed-chunk-17

plot of chunk unnamed-chunk-18

Barplot

SPSS Barplot

plot of chunk unnamed-chunk-19

R pirateplot

plot of chunk unnamed-chunk-20

Two plots of the same data

Barplot

plot of chunk unnamed-chunk-21

Pirateplot

plot of chunk unnamed-chunk-22

Scatterplot

SPSS Scatterplot

plot of chunk unnamed-chunk-23

R scatterplot

plot of chunk unnamed-chunk-24

R balloon plot

plot of chunk unnamed-chunk-25

More R plots

Radar chart

plot of chunk unnamed-chunk-26

Text cloud

plot of chunk unnamed-chunk-27

Reason 5: Simulations

  • In R, you can run simulations to directly answer important statistical questions

plot of chunk unnamed-chunk-29

Reason 6: Replication and sharing

plot of chunk unnamed-chunk-30

Reason 7: Writing reports and APA style papers

plot of chunk unnamed-chunk-31

Reason 8: Write interactive websites and experiments with Shiny

Reason 9: R is a transferable skill

  • R is one of the top languages for statistical analysis (along with Python).
  • If you learn R for psychology, you can use it in any other analytic field.

plot of chunk unnamed-chunk-33

Reason 10: It's FUN

  • You will have more fun with R than any other software, I promise.
  • People use SPSS because they have to, people use R because they want to.

plot of chunk unnamed-chunk-34

Why R is so great

  1. Free and open source
  2. Always have the latest, greatest methods
  3. Tell R what you want to do with your keyboard, rather than your mouse.
  4. Statistics (duh)
  5. Plotting
  6. Simulations
  7. Replication and Sharing
  8. Writing reports and APA documents
  9. Contributing to the R community
  10. Bonuses!!

plot of chunk unnamed-chunk-35

Questions before the tutorial?

Tutorial

I am ready to learn more R! What can I do?

  1. Find someone who knows R to help you
  2. Get an R book or take an online course
  3. Join an R group on social media
  4. Attend an intensive R bootcamp
    • September, 2017: Basel

plot of chunk unnamed-chunk-36

R books and Courses

Social Media

Contact