R quick reference cheat sheet

Here are some notes I took while learning about R:


  • ?matrix -- gets help on "matrix"
  • ls() -- lists variables that exist
  • rm() -- deallocates a variable

Run script from command line

Rscript hello.r


    typeof(x) returns the type of x


    Evolution of strapping a tablet on your face:


    Colbert iPad 2012


    AirVR iPad 2014

    Memory usage in Haskell is difficult to predict

    Laziness [in Haskell] makes it much, much harder to reason about performance, especially space.

    Consider a very long list of 'a's called long which we play with in GHC 7.6.3:

    largenum = 10000000
    as = repeat 'a'
    long = take largenum as

    Light Painting With Drones

    8 things to learn in school if you want to go into computer game programming

    A young relative of mine might be interested in computer game programming. I'm not in the game industry, but I drafted a list of things that I thought he might focus on in school.

    Wisdom of the herd

    The hammer principle lets you crowdsource your opinion about gin, martial arts, version control systems, web browsers, databases and programming languages.


    There's a recent meme that grit is important for success.

    Turning an external monitor on by default in Ubuntu

    To use a specific resolution, or turn on or off certain displays by default when you log in, you can create an .xprofile file in your home directory which runs xrandr commands.  For example, this .xprofile will turn on an external VGA monitor and set it to 1280x720 resolution and then turn off the internal LCD monitor on a laptop.

    xrandr --output VGA1 --mode 1280x720
    xrandr --output LVDS1 --off

    Why do teenagers act crazy?

    I've been trying to model asking "why" in front of my son when I remember to. Separately, at one point, I explained to him that he can say "I don't know" instead of "uhhhh, uhhhh, uhhhh."  This morning, these converged.


    Ryan: Does muffin make me taller?

    Wesley: Vegetables make you taller. Well, muffin is pretty good too

    Ryan: It's pretty good

    Wesley: . . . but vegetables have vitamins, if you don't get enough vitamins, you might get sick. Actually, you need a balanced diet: some vegetables, some fruit, some grain, and a little bit of meat.

    Ryan: . . . and a little bit of muffin.


    Subscribe to Wesley Tanaka RSS