Installing the ‘R’ programming language on OSX Mavericks

EDIT: It’s been pointed out that unless you are on a un-secure (such as most coffee shop) network, you are probably OK if you’re vulnerable. Just stay off public networks or large private networks.

Hey guys,

So previously lots of people in health sciences and other statically ‘rich’ jobs love to use ‘R'[1]. Its worth noting however that Python has now taken more market share than ‘R’ in the machine learning/big data field. Whatever the reasons for using R here is a quick guide to getting it up and running.

I’ll be demonstrating this using homebrew.

Open up terminal. (If you press Cmd + Space, it will pop up spotlight and you can just press “Term” and terminal should be the first thing on the list, press enter)
First if you don’t have homebrew installed, on the command line enter:
$ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
If you haven’t dealt with command line before the ‘$’ symbol at the start of a line signifies the start of the terminal command line, so don’t actually copy and paste the ‘$’.

Then after thats installed, make sure it worked properly by typing in:
$ brew doctor
And ensure that no errors have arisen.

Second, type
$ brew install gcc
After its done:
$ brew tap homebrew/science
Gcc is a compiler for code, but don’t worry about understanding it its simply needed to compile the R language.
The ‘tap homebrew/science’ is you ‘tap’ing into the wonderful world of scientific programming! (Through homebrew)

Third install XQuartz:
Go to the XQuartz website
Download and install XQuartz, the ‘Quick download’ option works just fine.

Fourth and final step:
Type:
$ brew install R
This last step will take about 10 minutes, so be patient!

There! You’re done! If you want to start fooling around, there is an interactive tutorial (very basic) at CodeSchool, if you’ve seen it before and want to know more, or read want to about it here.
After you can do some basic stuff in R, you can look at the graphing projects and libraries. What are libraries some of you non-coders ask? You can think of them as plug-ins that let a person use additional pre-created functionality, like graphing.
Here is the r-project website that talks about R.
And for the top 100 graphing libraries of R, take a look here, which will be very useful if you need to get some graphs/visualizations going.

If there is an interest in a quick post about creating re-usable software for R, please email the request to jonathan.stiansen@gmail.com.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s