16.1 if statements
# make a modification to this function
k_c <- function(temp_k) {
if (temp_k < 0) {
warning('you passed in a negative Kelvin number')
# stop()
return(NA)
}
temp_c <- temp_k - 273.15
return(temp_c)
}
Our current function does not deal with missing numbers
Error in if (temp_k < 0) { : missing value where TRUE/FALSE needed