3.15 Dynamic Checks

You may have noticed a pattern in our Dynamic Checks (i.e, checks that evaluate multiple test conditions simultaneously).

Below is a template for constructing a two-condition Dynamic Check.

Dynamic Checks for more than two test conditions follow similarly. The sapply function can be useful for evaluating many test conditions.

#Dynamic Check General Example (for two test conditions)

#Checking if either of the test conditions are true...
else if(any(c(test_condition1, test_condition2)){
  
  #Creating a TRUE/FALSE vector of the test conditions...
  dynamic_check <- c(test_condition1, test_condition2) 
  
  #Creating a vector of the test condition names...
  dynamic_check_names <- c("test_condition1_name", "test_condition2_name")
    
  #Creating a vector of the test condition names that are TRUE...
  dynamic_check_output <- paste0(dynamic_check_names[dynamic_check], collapse = " ")
    
  #Outputting to test.results... 
  test.results[2, 4] <- paste0("The following condition(s) are true: ", dynamic_check_output, ". (Any additional feedback as needed.)")
}