Can you check the indenting in here? I think you might also be able to simplify the if statements by modifying variables one-at-a-time, e.g. `df$xmin <- df$x - df$width/ 2`. (I now also prefer to avoid `transform()` since it's hard to see where the variables are coming from)