iA


An intro to R

by Karthik Ram. Average Reading Time: less than a minute.

A few weeks back I gave a talk at the local Berkeley R meetup group. The idea was to help people not make the same mistakes I made when I first started out learning R. It was the first time I made an entire presentation with Deck.js and I generated the syntax highlighted R code using knitr. Check it out.

6 comments on ‘An intro to R’

  1. Paolo says:

    Very useful introductory slides.
    On the slide 24 there is a small typo:
    x|y
    a|2
    should be:
    x|y
    a|3

  2. devin says:

    I’m curious about one of your slides – you said don’t set the working directory in the console, instead always set it in a script. This is contrary to Hadley Wickham’s advice http://stat405.had.co.nz/lectures/05-shortcuts.pdf

    He says never set your wd in a script.

    Do you mind sharing your reasoning behind setting the wd in a script?

    Thanks!

    • Karthik Ram says:

      Hadley’s approach is also the one I would recommend now (he did comment on this slide too). Setting one’s working directory from the console is a better practice.

      However, I targeted this presentation at academics who typically do not pay close attention best practices when it comes to programming. A common behavior I’ve seen is where all R scripts sit in one single folder, rather than being saved in the same folder as the corresponding project. In such cases, when executing R scripts, explicitly setting the working directory at the top ensures that results and figures don’t get written all over the hard drive (or wherever the most recent working diretory was set).

Leave a Reply