Error in if (length(range) == 1 || diff(range) == 0) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf