Solutions

This is a tricky type of "bug" because nothing in R went wrong and no error message was returned. Instead, we simply overlooked something in the code. As it turns out, when we pass a vector with missing values to sort, sort returns the sorted vector with the missing values removed. But if missing values are removed, then the length of the vector changes and we need to recompute it. This is a quick fix: we need to change n <- length(resp) in the body of the function to n <- length(sorted_resp).

results matching ""

    No results matching ""