Blog logotrial and stderr

Brandon Istenes

Beginning R Resources for Experienced Programmers

 •  Filed under r

Basics and Syntax

R Language for Programmers

5 Kinds of Subscripts in R

The Google Style Guide, which is better than the Advanced R one

In RStudio, auto-format your code with with the Styler Addin: install('styler')

Technique and Structure

Structuring R Projects

Advanced R, starting with Data Structures and Functional Programming

Data Manipulation using dplyr and tidyr

Gotchas

1:1 generates a sequence of length one, [1]. 1:0 generates a sequence of length two, [1, 0]. Therefore, when an object x with zero rows is passed into for (i in 1:nrow(x)), the code in the for loop will be executed twice, which is probably very different from what you expect. Therefore always use seq_len() or seq_along() in place of : ranges in your for loops. E.g., for (i in seq_len(nrow(x))). Reference.


Trying to learn R reminds me of when I, as an undergraduate math-philosophy double major, had to take a logic class in the philosophy department. In the math department, the class could have been compressed into two weeks. But in the philosophy department, even spread out over three months, it was the subject of much frustration for the less mathematically inclined philosophy students.

Similarly, most resources for learning R are directed at non-programmers, and as such are painfully gentle. So I will be maintaining here a list of satisfyingly terse explainers and tutorials.

OpenMRS Architecture Proposal: Modules & Bundles

 •  Filed under openmrs

This is an architecture proposal for OpenMRS. I advocate defining a single, universal configuration mechanism. This will encourage better software practices, make OpenMRS easier to use, and strengthen the community's ability to support it. read on...

Syncing Google Drive on Linux (using ODrive free)

 •  Filed under linux

GNOME's Google Drive integration never quite seems to work for me. So I started using google-drive-ocamlfuse, which is great, if you're happy with using Google Drive as a remote mount. The internet where I am isn't reliable enough for me to trust that kind of connection, so I'm looking for a Google Backup and Sync type option for Linux.

I've found one I'm happy with.

It's ODrive. Yes, there's no desktop client for Linux (yet?). Just the miserably poorly documented ODrive CLI. But it's not actually hard to get it working.

Scott Lowe wrote a great post that covers just about everything. Go read that. Then, if you're using GNOME, do the following.

Add a "Sync" option to the Nautilus right-click context menu (gist here):

#!/bin/bash
# Put this file at ~/.local/share/nautilus/scripts/Sync
# Remember to `chmod +x` it

IFS='
'
for file in ${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}
do
    if [[ $file == *.cloud ]] || [[ $file == *.cloudf ]]
    then
        odrive sync "$file"
    fi
done

Installing Ubuntu on a USB Drive

 •  Filed under tutorials, linux

After many, many failed attempts, I finally got this working, and nonetheless in a very convenient fashion. I also got the flash drive Ubuntu running within VirtualBox, so I can administer it from the comfort of my host machine's OS. Awesome. If you're not interested in knowing what attempts failed, read on...