powered by
What Is the Next Non-Null Data Point?
find_next_good_datapoint(data_row, index, n_replicates)
The next good data point or -999 if none is found.
A numeric vector representing the data row.
The index of the current data point.
The total number of replicates (length of the row)
Given a data row, an index, and the number of replicates (the number of elements in the row), this function finds the next good data point in the row.
A good data point is a non-missing value (not NA) with a non-empty string.
data_row <- c(NA, 3, 2, NA, 5) index <- 1 n_replicates <- 5 find_next_good_datapoint(data_row, index, n_replicates) # expect 3
Run the code above in your browser using DataLab