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

Are you susceptible to the latest ‘evil’ ShellShock bug? If you have a mac or linux, try this.

UPDATE: For you mac users, here is the current patch: http://support.apple.com/kb/HT6495

You HOPEFULLY have heard about this new issue, or ‘bug‘ that many computers probably have.

If you haven’t, its called the Shellshock bash bug – its bad, real bad.

So first, do you have a windows machine? If yes, you are PROBABLY just fine – except if you have a server somewhere, then it probably is vulnerable to the bug…

So is your data on servers that are vulnerable, what servers are vulnerable? A lot of them.

So sleep easy knowing that your data may become someone else’s… sorry I’m just fear mongering.

Here’s the test:

If you have a mac, press ‘Command’ + ‘Space’, the start typing ‘terminal’ one you see terminal, click on it. Or in linux open your terminal.

You should see something like this:
Screen Shot 2014-09-26 at 8.33.47 AM

env X="() { :;} ; echo busted" /bin/sh -c "echo stuff"

When you enter the above, it should look like this (if vulnerable effected):

Screen Shot 2014-09-26 at 8.34.22 AM

If you have a linux computer, here is a link to the fix: https://access.redhat.com/articles/1200223

Though it should be noted, you won’t be totally safe.

What if I have a mac?

Well, we’re actually temporarily out of luck. Having the latest macbook pro model with all of the updates still doesn’t preclude you from vulnerability – after all thats what I have. Apple has claimed that it doesn’t effect many users, though being totally up to date and being vulnerable, I think that’s BS.

We have to wait for apple to come with an update for Mac before we can do anything. By the time you read this there may be one, check by clicking on the apple symbol in the top left, and click ‘software update’. Hopefully something will be there that fixes this bug, but for now.

Solution?

Close your computer for a few days, or day, or some amount of time. Turn it off, read a book, turn off internet, it’ll probably be a better day for you anyways. Sit back and enjoy your non-tech comforts.

A great tech article on this bug can be found here. The bash script I got from Troy Hunt in that post.

3 step process to being a ‘tab pirate’ with google chrome

Painty the Pirate

I don’t know about you, but I am a tab pirate. You can be a tab pirate too, because hey, everyone starts somewhere.

What does it mean to be a tab pirate? Well you effectively make use of having millions (or at least a few) tabs open at a time in Google Chrome without destroying your battery life!

Example:

  1. You’re you’re studying, looking for articles, or doing some fun programming stuff on your own
  2. You open up every tab that looks like it might be relevant
  3. Something comes up, distracting you from your work
  4. You leave those tabs (and chrome) open because you don’t want to bookmark them all

Guess what you have to do? Either stop getting distracted and do one thing to completion (but lets be honest, thats not always realistic) or become a tab pirate!

Steps to becoming a tab pirate:

  1. Get a parrot
  2. Download ‘The great suspender’
  3. When you get distracted (or when you finally remember that you got distracted) click on the cool little face in the top corner of your browser and click suspend all. 

It keeps all tabs there but it makes them stop running until you go to them and click reload.

I’ve seen my battery life double almost instantly from doing this to all my un-used tabs.

Another solution is to download ‘Read it later’, which lets your quickly save the url in a ‘queue’ that you can quickly retrieve later through the app.

Thanks for reading!

Who cares about UBC, right???

Thats me with the glasses

“I’m here to kick ass and chew bubble gum, and I’m all out of bubble gum…” – Nada, “They Live (1988)”

Why are you writing a blog, dude? Who really cares about someone going to UBC?

I want to have some fun! Lets be honest, we could all use a bit more of that, right? I will try to litter my blogs with movie quotes and geeky references, because blogging sucks if you aren’t having fun.

I’m also wanting to share learning strategies I’m doing, or have looked into. Talk about classes I’m taking, try to summarize them for people who are taking them in the future. Of course there will be angry posts, and whining because what fun is reading a blog without a little of that. Oh yes, there will be many grammatical errors and spelling mistakes! HURRAH!

I want to learn! I want my views challenged by readers, I want to grow, to remember, and to take advantage of this short time left I have at UBC. Life is learning, so its naive to think that “only one year left and I’ll be done”. Sure school is challenging, and some of us put too much of our life and soul into it while we’re here (yes me too), but it is also rewarding if we’re open to it.

Who I am:

I’m a 26 year old fourth year student (yes I’m probably older than other students), thats part of a biker gang… minus the tatoos, leather, large amounts of fat all over my body, funny story, I also don’t have a bike. So I’m pretty much a normal dude that decided to go back to University.

When I came back, I started doing a B.A. in Psychology. But before the year started I thought to myself, “a psychology degree on its own is useless… I’ll do cognitive systems so I can take all the psych courses but not have to just have a psych degree!”

But then I found out two of the requirements for doing a cogs degree is…. COMPUTER SCIENCE!!! 😮 [mouth falling open]. “I can’t do computer science.” So with shaky knees I scheduled my whole first semester around taking two computer science courses, 110 and 121. I went to http://blog.ratemyprofessors.com/ and made sure I got the BEST rated professors for those courses.

Guess what happened?

That was the best semester I’ve (almost) ever had, up to this date. It was so much fun, and I learned so much! Who would have known I’d like computer science?

– Feedback:

Give me feedback if there is something you’d like to see, or something you’d like to hear about. I’m going to do what I can to share on this blog but sometimes it just won’t happen if I’m procrastinating.