A function that returns local maxima and minima in a profile

local_extrema(sr)

Arguments

sr

tibble with columns l and z describing profile

Value

tibm a tibble of local maxima ("locmax") and minima ("locmin")

Examples

s1 <- tibble(l=c(1.2,5.3,8.1,12.0,13.1, 15.5,16.8,17.6,18.1,19.2, 21.3,23.1,24.1,25.2,26.5, 29.7,38.0,40.0,42.1,44.4), z=c(7.2,7.3,8.1,6.8,7.1, 1.3,2.0,2.2,1.1,1.8, 1.5,2.5,2.8,3.1,2.8, 2.1,3.3,5.0,4.6,6.2)) local_extrema(s1)
#> # A tibble: 14 x 4 #> id l z locext #> <dbl> <dbl> <dbl> <chr> #> 1 1 1.2 7.2 locmax #> 2 3 8.1 8.1 locmax #> 3 4 12 6.8 locmin #> 4 5 13.1 7.1 locmax #> 5 6 15.5 1.3 locmin #> 6 8 17.6 2.2 locmax #> 7 9 18.1 1.1 locmin #> 8 10 19.2 1.8 locmax #> 9 11 21.3 1.5 locmin #> 10 14 25.2 3.1 locmax #> 11 16 29.7 2.1 locmin #> 12 18 40 5 locmax #> 13 19 42.1 4.6 locmin #> 14 20 44.4 6.2 locmax