top of page
Writer's pictureMerle van den Akker

Coding: do I have to?!


If you follow my twitter (or know me in real life), you know I complain about coding a lot. I code in R. It’s the bane of my life. I will not be able to quit learning R any time soon. Now some people have asked for advice on getting into R, staying with R, and not throwing their laptops out of the window whilst doing R. Don’t worry, I got you.

Getting into R I’d recommend you start with RStudio, unless you are a Linux-beast. Get R and Rstudio installed and then check out some nice YouTube tutorials. It will literally take you through all the basics: dplyr, data.table, tidyverse or just base r. You can do this.

More old school and want a book? How about a book completely written in R? Yes ladies and gents, there is R Markdown, which let’s you put in code and is able to convert all of the output into a PDF, HTML or Powerpoint. So that entire book is online. It is written by Hadley Wickham (thanks dude) and you can find it here.

If you think you are never able to understand coding, stop it. Yes you can. It might seem super counter-intuitive and difficult, but honestly, YouTube and the book linked above will explain this so well. You can do it. And if everything goes wrong from the get go, coding is something you can only learn through keeping at it. An error message is not the end of your life.

Staying in R Although most people think of coders as nerds locked up in their bedrooms without pants on (sorry), you need not be that person. Once you have gotten into the swing of it, you might hit a plateau. You’ve learned the basics, but now that you’re trying harder stuff you get error message after error message. You are fed up. You obviously don’t get it. Maybe coding is just not for you…

No! Everyone can learn coding. Just don’t go at it alone. You can literally code and hang out with people, preferably people who are also coding. Within my MSc, it was actively encouraged to work on the assignments as a group. So, in the end, we had VERY similar looking scripts, and the same graphs and analysis etc. You know what we also had? Our sanity. Stick together. Don’t go at it alone.

If you still prefer to suffer in silence in real life, you can still go online and find your crowd. Stack Overflow is a great site for questions and answers about R. Just google your question and this site will pop with an answer for it. You can literally copy code, see if it works right away or make some small edits to fit your code. If, shockingly enough, Stack Overflow doesn’t have the exact answer, you can just post your question and hope someone answers it. Very often people will. It works like a forum and does have a point system, so you get what you give. So, if you see someone who is struggling, and you think you might know the answer, help them out! Learning is more fun together.

Not throwing your laptop out of the window when doing R After error message 54, you might have just had it. You have been stuck forever. This has cost you three hours already, to fix something that seemed to work just fine yesterday…

This stuff can get rough. Because things that don’t work after having been at it for hours and hours just are frustrating. Some people deal with this quite well. Others (me) not so much. Pro-tip from R-wizz Neil Stewart: if you can’t fix it in an hour, leave it. Just take a break, walk away, get back to it later. If that still doesn’t work, ask someone who’s around. Maybe they can help. Otherwise just Stack Overflow it and do something else until you have an answer.

Very likely the problem was minor. A semi-colon that should have been put somewhere else, or was missing, or was never supposed to be there. Or all of the above. It’s R. Who knows?

Why code at all? I have written a previous article about Big Data, and how it is not going away. Every single time we go online, we give permissions for cookies and our information is being gathered. We don’t even have to go online, banks, supermarkets, clothing stores etc. are collecting data about us wherever we go, whatever we are doing. This data exists. Now we need someone to crack it.

I know no one is a fan of being exploited through means that look like passive stalking, but Big Data can be used for good. Every (big) company has a lot of data on their consumers. You just need someone who understands what they are looking at. Why wouldn’t you be that person?

If you want to be that person, you are going to need to learn how to code. If you want to test if a policy or intervention works, you need to analyze (read: code) the results and see if there was an effect. If you want to test anything on a large scale and look for an impact: code!

On an individual level: you can make the trade off between the service rendered and the information you need to give up for it. I have discussed this before, so I won’t dive into this again now.


Why code in R? There is many more languages out there to code in. So why would you do R specifically? If you ask me, the fact that R is free is a massive reason to do it. And because it is free, it has a massive community behind it. So, sites like Stack Overflow work. Moreover, there is not just sites, most packages are built by “random” people as well. Random people just meaning people that are not employed by the “R company.” Everyone can create a package to put a new function or extension on R. As such, R has become capable of doing almost everything that you could possibly want to do with data. So R just seems to be for everyone, by everyone. You can call me sentimental, but I like that.



If you have any questions about starting in R, how to wrap your head around the aspect of coding, just let me know. Otherwise, just join the cult!

Comments


Behavioural Science

Personal Finance

Interviews

PhD

bottom of page