R and I…

…by Bérengère / from France / PhD Psychiatry / 5th Year

I have a conflictual / love-hate relationship with R.

I’ve never been into coding, and I’m afraid I’ll just never be into coding. I’m profoundly statophobic (phobia of stats) and I really don’t need another layer of trauma when I have to do stats. And yet, I’ve decided to use R for my PhD (PhD here stands for Pain, Hopelessness, Despair). Here is why.

Context: My 1st encounter with R = Elisabeth’s 1st encounter with Mr. Darcy.

I was first introduced to R in my Master 2, and boy that didn’t start well. I could see why some people could fancy it, but from the moment I opened the script editor I decided it would never work between us, even though all I had to do was copy-paste commands from the course manual. One misplaced comma, one missing argument, and you get upset? Not for me thanks! I’m not into needy programs.

I then actively avoided R during my research placement, and hoped that would be the end of it. I was wrong.

5 reasons why:

1. Peer. Pressure. (Maggi if you read this…). In 1st year someone (Maggi) spent hours telling me how wonderful and useful and brilliant R was. I figured I could give it another go.

2. If not now, when? Let’s face it, some basic knowledge of R is becoming a necessity in research. Now you can tell yourself you’ll learn it later, in your “spare time” (hilarious) maybe after your PhD, or even better, you’ll learn it during your post-doc. You know it won’t happen. I know it won’t happen. The entire Universe knows it won’t happen. You have to learn R right before / while you need to use it, otherwise nothing will drive you through the R misery.

3. What have I done already? I consistently forget what I’ve tried to do with my data, and that’s quite problematic in research. One of my favourite things about R is the Script. The Script remembers it all. No need to write down what you intended / hoped to do, it’s all safely coded in the Script. Every single step of the data pre-processing / processing / analysis / visualisation is written down and saved forever (until you delete the script, that is).

4. (Reduce), Reuse, Recycle. You can reuse your scripts! One new participant? Just re-run the entire script! Similar pre-processing needed for several datasets? Copy-paste the script! You’ve found the perfect visualisation for all your data? One Script to rule them all!

5. Master of Transparency. Open Science is (hopefully) the future, and being able to openly share everything that was done to the data is the only way to ensure high-quality research. With R (and its Scripts), you can simply share your original dataset, your script, and the whole world can see what was done to the data.

3 things that will be tough. Brace yourself:

1. In 1st year I attended an R workshop. I didn’t even manage to open the dataset. In R, little things like opening a file or saving a file the 1st few times can bring you to tears. It gets better. Just save the line of code and reuse it next time.

2. You can spend 2 days on StackOverflow looking for a way to write what you want to do. When it comes to R, knowing what to type into Google is an extremely valuable skill. In a time of deep distress (3 days spent trying to write a loop) my friend Maureen helped me with my script, saying “I don’t know how to write what you want to do, but I know what to ask Google”.

3. When it comes to sharing your codes with other researchers, you might (as I do) experience a feeling of absolute shame. Showing the whole world what was done to the data is essential for research, but it’s scary. It’s terrifying actually. I find this is a great way to feel like I’m not a “good-enough” researcher because my stats are crap and my scripts look like I wrote them drunk. I like to think this anxiety drives me to (slowly and painfully) improve my stats / coding skills. One day I won’t feel ashamed of my scripts.

3 things that will help you, you’re not alone:

1. Don’t underestimate the power of in-script comments. I like to leave myself comments and explanations, advise and tips, for my future self. I’m very grateful to my past-self every time I read them.

2. Find pals who are trying to use R, and share your misery and experiences. In Edinburgh we have a meet-up group, “R ladies in Edinburgh” for more serious discussion about R, but honestly the smallest things also make a huge difference. Lorna and I both reluctantly decided to use R at the same time, and very often one of us would pop by the other’s office to see if she had ever tried doing a particular thing. Share the codes, share the love.

3. R courses can be very useful, but I recommend you join them either right before you start using R, or as you are starting to use R. If you go a few months before actually using it, you’ll have forgotten everything by the time you open R again.

Few things have the power to both break you down and lift you up. R gives you some of your lowest lows, and some of your highest highs. R has brought me to tears on the days when I just couldn’t find what was wrong in the script (probably a misplaced comma), but R has also made me absolutely ecstatic when I managed to solve a friend’s problem in 1 minute.

Recently I had to run some pre-processing on Excel, and within one hour I was completely infuriated. Something happened then that I never thought would happen: I missed R.

I dedicate this post to all the researchers out there in an abusive relationship with R. You’re not alone.

(I take this opportunity to publicly thank my R angels Maggi and Catherine, without whom I’d still be trying to open the dataset.)



Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Report this page

To report inappropriate content on this page, please use the form below. Upon receiving your report, we will be in touch as per the Take Down Policy of the service.

Please note that personal data collected through this form is used and stored for the purposes of processing this report and communication with you.

If you are unable to report a concern about content via this form please contact the Service Owner.

Please enter an email address you wish to be contacted on. Please describe the unacceptable content in sufficient detail to allow us to locate it, and why you consider it to be unacceptable.
By submitting this report, you accept that it is accurate and that fraudulent or nuisance complaints may result in action by the University.