I was browsing #rstats on Twitter recently and came across this question:
Neat problem, I’ll take a quick look. So I answered the tweet. But the more I’ve dwelt on the question, and looked at the replies, the more I think this would make a great exercise in an interview. It’s a simple enough problem, but how someone chooses to answer it tells you a lot about the kind of colleague they would be.
Example responses ranged from a literal reading of the question, which used R to solve the problem in a spreadsheat way. To others who arrived at an answer, but discarded some steps not required by R. (these steps may have only been included to fully explain the question.
So, fancy having a go yourself? Here’s the sample data:
library(tidyverse) tibble(A = c(100, 50, 100, 50), B = c(50, 100, 50, 100)) %>% mutate(A_minus_B = A - B, sign = if_else(A_minus_B > 0, "positive", "negative"))
What would you do? What would you want to see from a candidate if you asked them this at an interview?