Faces of “if”

The ifelse statement (a.k.a., conditional statement, conditional expression, etc.) is a basic feature of programming languages. In the languages I first learned (BASIC, C, Python), I thought if-else was a monolithic thing. Many languages have an elseif statement, and some languages (e.g., C, Ruby) have a switch or case statement that takes care of complicated if-elseif-elseif-elseif… situations. All of these are just syntactic sugar for a chain of if-else statements, which reinforced my idea that if-else was monolithic.

• • •

ggplot gotcha: beware jittering your data

I like to overlay boxplots with a scatter plot so that you get the comfort of seeing the real data with the easiness of seeing the mean and IQR. Here’s an example with some fake data in a data frame that I’ll call dat:

group val
A 0.6
B 1.6
A 0.7
B 1.7
A 0.8
...

• • •