Test conditions within an R data frame