Skip to content

Swimming in a sea of code

If you are looking for code here, move on.

In the beginning, there was only the relentless blinking of the cursor. With the maddening regularity of waves splashing on the shore: blink, blink, blink, blink…Beyond the cursor, the white wasteland of the empty page: vast, featureless, and terrifying as the sea. You stare at the empty page and primordial fear engulfs you: you are never gonna venture into this wasteland, you are never gonna leave the stable, solid, familiar world of menus and shortcuts, icons and buttons.

And then you take the first cautious steps.

print ‘Hello world’
> Hello world
, the sea obliges.

1+1
> 2
2+2
> 4

You are still scared, but your curiosity is aroused. The playful responsiveness of the sea is tempting, and quickly becomes irresistible. Soon, you are jumpting around like a child, rolling upside-down and around and around:

> a=2
> b=3
> a+b
5

> for (x in 1:60) print (x)
1    2    3    4    5    6    7    8    9   10   11   12   13   14  15   16   17   18   19   20   21   22   23   24   25   26  27   28   29   30   31   32   33   34   35   36   37   38  39   40   41   42   43   44   45   46   47   48   49   50  51   52   53   54   55   56   57   58   59   60

The sense of freedom is exhilarating. You take a deep breath and dive:

> for (i in 1:10) ifelse (i>5, print ('ha'), print ('ho'))
[1] "ho"
[1] "ho"
[1] "ho"
[1] "ho"
[1] "ho"
[1] "ha"
[1] "ha"
[1] "ha"
[1] "ha"
[1] "ha"

Your old fear seems so silly now. Code is your friend. The sea is your friend. The white page is just a playground with endless possibilities.

Your confidence grows. You start venturing further into the deep. You write your first function. You let code scrape the web for you. You generate your first random variable. You run your first statistical models. Your code grows in length and takes you deeper and deeper into unexplored space.

Then suddenly you are lost. Panic sets in. The code stops to obey; you search for the problem but you cannot find it. Panic grows. Instinctively, you grasp for help for the icons, but there are none. You look for support by the menus but they are gone. You are all alone  in the middle of this long string of code which seems so alien right now. Clouds gather. Who tempted you in? How do you get back? What to do next? You want to turn these lists into vectors, but you can’t. You need to decompose your strings into characters but you don’t know how. Out of nowhere encoding problems appear and your entire code is defunct. You are lost….

Eventually, you give up and get back to the shore. The world of menus and icons and shortcuts is limited but safe. Your short flirt with code is over forever, you think. Sometimes you dare to dream about the freedom it gave you but then you remember the feelings of helplessness and entrapment, of being all alone in the open sea. No, getting into code was a childish mistake.

But as time goes by you learn to control your fear and approach the sea again. This time without headless enthusiasm but slowly, with humility and respect for its unfathomable depths. You never stray too far away from the shore in one go. You learn to avoid nested loops and keep your regular expressions to a minimum. You always leave signposts if you need to retrace your path.

Code will never be your friend. The sea will never be your lover. But maybe you can learn to get along just enough as to harness part of its limitless power… without losing yourself into it forever. >

R start screen

Published inR

8 Comments

  1. Brilliant. I love the imagery. This is exactly how I felt as a noobie to R. It has become my very very good friend though.

  2. This is exactly how I felt… but I am at the stage where I am just beginning to dip my toes into code again after the panic

  3. thanks for the comments, glad that my relationship with R (and other code) with its ups and downs has not been so unique

  4. Daniel Pritchard

    Nice post. Yes this is exactly what it feels like in the beginning. But Kevin is right: It does get better. I have to be honest though: I had a little smile on my face when I read…
    print ‘Hello world’
    What? Wait! An unexpected what? Oh god, we’re going down! Man the life rafts!

  5. Aaaaannnd… this is why we follow Mr. Burns’ (not the owner of the Springfield nuke plant; the other one) leadership thru The R-Inferno. Well, that and StackOverflow!

  6. Anonymous

    Great post. Arrived and survived VBA. Drowned with R but venture once more. Sometimes feels like you need to experience the helplessness in order to venture forth.

  7. Helena Baptista

    Very good! 🙂
    R was my first attempt to work without menus and buttons, and is really scary at the beginning, it still is… and has you say it eventually become better, I am still waiting for that time when I will not cross my fingers every time that I press enter and wait to see if it worked or not.
    Thanks for making me feel that I am not alone.
    Cheers

  8. Nice post and very recognizable. When learning R it was sometimes frustrating to figure out where my scripts went wrong. I had to search a lot for solutions and asked some questions on StackOverflow and the ggplot2 mailing list myself. However, once I had become accustomed to the rough sea of R, SPSS seemed like a quiet backwater when I had to use that for the first time 🙂

Leave a Reply

Your email address will not be published.