Open jordansread opened 6 years ago
for https://github.com/GLEON/rLakeAnalyzer/blob/2253bd90f109d9cebf6a5e63fb756a6a474cbc14/R/center.buoyancy.R#L32 we only test the top two depths, then ignore anything below but have an assumption that depths aren't scrambled below the top two.
So this will make it through the test:
depths = c(0, 0.5, 1, 9.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
we can use
all(depths == cummax(depths))
to test for this if we need depths to be monotonically increasing (or cummin(depths) for decreasing)
cummin(depths)
Weird, that isn't a very useful check.
Alternative to all(depths == cummax(depths)), could use is.unsorted to check. Big question here really is do we want to sort it for the user, or just throw an error?
is.unsorted
for https://github.com/GLEON/rLakeAnalyzer/blob/2253bd90f109d9cebf6a5e63fb756a6a474cbc14/R/center.buoyancy.R#L32 we only test the top two depths, then ignore anything below but have an assumption that depths aren't scrambled below the top two.
So this will make it through the test:
we can use
to test for this if we need depths to be monotonically increasing (or
cummin(depths)
for decreasing)