I'm trying to extract numbers from intervals (in this case the variable LONG) in one xmax and one xmin. Unfortunately when I'm trying to do that, the result is not correct and I do not get the digits. the intervals are set up with cut
my will is to do a ggplot graph with geom_rect
, for that I need xmin and xmax
Here is a sample of my dataset
dput(head(df, n =200))
structure(list(Param = c("fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "par", "par",
"par", "par", "par", "par", "par", "par", "par", "par", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"par", "par", "par", "par", "par", "par", "par", "par", "par",
"par", "salinity", "salinity", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "par", "par", "par", "par", "par", "par", "par",
"par", "par", "par", "salinity", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "salinity",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "par", "par", "par", "par", "par",
"par", "par", "par", "par", "par", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "salinity",
"salinity", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity"), ymin = c(220, 85, 0, 175, 25, 70, 225, 220, 100,
70, 100, 85, 70, 25, 175, 0, 50, 180, 220, 225, 180, 0, 220,
90, 25, 180, 100, 85, 50, 175, 25, 70, 90, 85, 85, 225, 180,
0, 90, 85, 85, 180, 0, 0, 220, 180, 225, 90, 50, 25, 200, 50,
50, 350, 220, 90, 0, 275, 25, 225, 350, 420, 480, 350, 225, 90,
90, 70, 420, 90, 0, 100, 290, 180, 85, 400, 85, 90, 70, 200,
50, 90, 300, 0, 180, 400, 90, 90, 200, 275, 200, 175, 70, 175,
100, 300, 90, 220, 50, 290, 70, 290, 200, 200, 85, 100, 100,
90, 25, 180, 290, 25, 400, 220, 200, 50, 0, 25, 275, 480, 400,
300, 220, 0, 300, 220, 175, 100, 275, 180, 50, 400, 0, 0, 420,
180, 290, 290, 90, 50, 275, 220, 275, 180, 290, 100, 175, 50,
25, 225, 0, 85, 85, 100, 100, 175, 85, 180, 275, 90, 70, 275,
90, 85, 90, 175, 180, 200, 85, 180, 50, 85, 350, 180, 50, 200,
0, 90, 25, 90, 50, 50, 180, 200, 90, 220, 50, 90, 25, 85, 200,
90, 70, 0, 90, 180, 50, 50, 70, 0), ymax = c(225, 90, 25, 180,
50, 85, 275, 225, 175, 85, 175, 90, 85, 50, 180, 25, 70, 200,
225, 275, 200, 25, 225, 100, 50, 200, 175, 90, 70, 180, 50, 85,
100, 90, 90, 275, 200, 25, 100, 90, 90, 200, 25, 25, 225, 200,
275, 100, 70, 50, 220, 70, 70, 400, 225, 100, 25, 290, 50, 275,
400, 450, 500, 400, 275, 100, 100, 85, 450, 100, 25, 175, 300,
200, 90, 420, 90, 100, 85, 220, 70, 100, 350, 25, 200, 420, 100,
100, 220, 290, 220, 180, 85, 180, 175, 350, 100, 225, 70, 300,
85, 300, 220, 220, 90, 175, 175, 100, 50, 200, 300, 50, 420,
225, 220, 70, 25, 50, 290, 500, 420, 350, 225, 25, 350, 225,
180, 175, 290, 200, 70, 420, 25, 25, 450, 200, 300, 300, 100,
70, 290, 225, 290, 200, 300, 175, 180, 70, 50, 275, 25, 90, 90,
175, 175, 180, 90, 200, 290, 100, 85, 290, 100, 90, 100, 180,
200, 220, 90, 200, 70, 90, 400, 200, 70, 220, 25, 100, 50, 100,
70, 70, 200, 220, 100, 225, 70, 100, 50, 90, 220, 100, 85, 25,
100, 200, 70, 70, 85, 25), LONG = c(-23.99908333, -24.38488333,
-23.07351667, -23.99908333, -24.9915, -24.38488333, -23.99908333,
-24.9915, -23.99908333, -23.07351667, -23.99908333, -23.07351667,
-23.07351667, -23.07351667, -23.99908333, -24.38488333, -23.99908333,
-25.15166667, -24.9915, -24.9915, -25.15166667, -24.9915, -23.99908333,
-25.15166667, -23.07351667, -24.38488333, -25.15166667, -24.38488333,
-24.9915, -24.38488333, -23.07351667, -23.99908333, -24.9915,
-24.9915, -25.15166667, -24.9915, -23.99908333, -23.99908333,
-25.15166667, -24.38488333, -23.99908333, -25.15166667, -23.07351667,
-25.15166667, -23.99908333, -24.38488333, -23.99908333, -24.38488333,
-24.38488333, -23.99908333, -26.1858, -26.1858, -19.79766667,
-25.8803, -21.292, -26.1858, -19.79766667, -24.84261667, -22.91008333,
-22.91008333, -22.91008333, -24.84261667, -24.84261667, -24.84261667,
-19.79766667, -24.84261667, -26.1858, -19.79766667, -26.1858,
-18.79291667, -19.79766667, -21.292, -25.8803, -25.8803, -25.8803,
-25.8803, -26.1858, -25.8803, -18.79291667, -26.1858, -19.79766667,
-21.292, -21.292, -26.1858, -26.1858, -25.8803, -18.79291667,
-25.8803, -26.1858, -26.1858, -21.292, -24.84261667, -25.8803,
-22.91008333, -25.8803, -24.84261667, -25.8803, -22.91008333,
-21.292, -25.8803, -25.79463333, -24.36675, -26.3169, -25.79463333,
-27.45433333, -27.45433333, -27.34373333, -27.34373333, -27.45433333,
-26.3169, -24.36675, -24.68571667, -24.36675, -25.79463333, -26.3169,
-27.34373333, -21.74423333, -24.36675, -25.79463333, -25.79463333,
-24.36675, -25.79463333, -25.79463333, -21.74423333, -26.3169,
-24.36675, -27.45433333, -24.68571667, -26.3169, -21.74423333,
-27.45433333, -26.3169, -27.45433333, -24.36675, -25.79463333,
-25.79463333, -21.74423333, -25.79463333, -26.3169, -27.34373333,
-25.79463333, -26.3169, -26.3169, -21.74423333, -24.68571667,
-21.74423333, -25.79463333, -24.36675, -25.79463333, -24.36675,
-24.23426667, -24.23426667, -22.3131, -23.79151667, -22.3131,
-23.79151667, -23.79151667, -22.3131, -22.3131, -24.23426667,
-22.3131, -22.3131, -23.79151667, -24.23426667, -24.23426667,
-22.3131, -22.3131, -22.3131, -22.3131, -23.79151667, -22.3131,
-23.79151667, -22.3131, -22.3131, -23.79151667, -22.3131, -22.3131,
-23.79151667, -22.3131, -24.23426667, -23.79151667, -22.3131,
-23.79151667, -22.3131, -22.3131, -22.3131, -22.50893333, -23.79151667,
-22.3131, -22.3131, -22.3131, -22.3131, -22.3131, -22.50893333,
-23.79151667, -23.79151667, -23.79151667, -24.23426667, -23.79151667,
-24.23426667), Transect = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L),
Value = c(0.08155852, 0.301815, 2.11627123809524, 0.08916896,
0.507806576576577, 0.376436462585034, 0.0796680773480663,
0.1813794, 0.116901057486631, 0.1968154, 2627.6870493992,
2627.7, 2627.70733333333, 2627.1951754386, 2627.7, 2627.56344086021,
2627.68923076923, 2627.69066666667, 2627.68, 2627.628, 34.5028693333333,
30.9015205882353, 34.624076, 33.471937, 34.0278530701754,
34.41674, 34.2245157543391, 33.1686533333333, 32.0401374358974,
34.3630434782609, 0.373296035242291, -1.09827823129252, -0.0840888888888889,
-0.0634604166666667, -0.414382, 0.19323, 0.3229585, 3.32400091743119,
-0.264504, -1.16256888888889, 0.49808, 301.2888, 0.546442857142857,
0.162839130434783, 1.81076, 2.19845, 1.6837679558011, 1.26615306122449,
0.814464646464646, 0.501614406779661, 0.059190285, 0.177087824120603,
0.665356180904523, 0.058553848, 0.07536708, 0.0737848, 1.16467572093023,
0.0630026533333333, 0.23709368, 0.067377656626506, 2627.74427244582,
2627.99566666667, 2628, 2628.0024, 2627.51050955414, 2628.2,
2628.2, 2627.50939597315, 2628.02584269663, 2627.9, 31.7818344186046,
34.4198116778524, 34.850228, 34.515901, 33.271, 34.8825898876404,
33.171312, 33.424846, 34.8067797297297, 34.5658145, -1.15515929648241,
-1.100712, 1.03213333333333, -0.217482105263158, 0.52464,
1.16056777777778, 2.24784, -1.114498, 0.7014795, 1.34177866666667,
1.016445, 0.45492, 0.467193333333333, 0.52288, 0.478332,
0.443222, 0.48876, 0.64078, 0.5768391959799, 0.46814, 0.0939222266666667,
0.06841773, 0.061016615, 0.06290749, 0.09016486, 0.0804777333333333,
0.125759906666667, 0.1289748, 0.174537983870968, 0.06137775,
2304.45894736842, 2231.32943548387, 2307.9145, 2289.804,
2295.2175, 2246.1025, 2265.73160377358, 2234.63024193548,
2293.86344827586, 2296.96853932584, 34.8405795, 34.6621464,
34.622442, 31.0418495283019, 34.65429, 34.74115, 34.504436,
34.2193344, 34.640094, 34.7676935, -0.0138485, 1.1815845,
-0.0814205240174673, 0.0226313043478261, 1.02302666666667,
0.5469705, 1.459401, 0.738181, -0.086665, -0.79061, 0.522664429530201,
0.56066, 0.555146666666667, 0.451445, 0.519727272727273,
0.435349397590361, 0.51554, 0.563185, 0.635352226720648,
0.566462, 0.751869561403509, 0.10155436, 0.0923774, 0.0732783297730307,
0.0726548930481283, 0.06541158, 0.08988464, 0.067170565,
0.0659365637583893, 0.106267666666667, 2248.35, 2306.9744966443,
2262.43608247423, 2236.832, 2228.29074074074, 2299.292, 2300.9735,
2303.06256410256, 2257.012, 2298.51875, 32.469601025641,
33.493826, 34.8967571428571, 34.7009225, 32.3693575, 34.7672785,
30.031902764977, 33.642694, 31.9030281512605, 33.6745559322034,
-1.635342, -1.62691897435897, 1.312134375, 1.420105, -1.28701,
1.50606, -0.82618, -1.200252, -1.57529705882353, -1.401896,
0.52944, 0.53251, 0.548925675675676, 2.22144104803493, 0.73419,
0.7245, 0.641565, 18.004535, 0.710006666666667, 3.60904385964912
)), row.names = c(NA, -200L), class = c("tbl_df", "tbl",
"data.frame"))
Here is the code
#set up intervals
require(tidyverse)
require(dplyr)
setx <- c(-27.75000,-27.45433,-27.34373,-26.37667,-26.31690,-26.18580,-25.88030,-25.81823,-25.79463,-25.15167,-24.99150,-24.84262,-24.68572,-24.38488,-24.36675,-24.23427,-24.01542,-23.99908,-23.79152,-23.07352,-22.91008,-22.50893,-22.31310,-21.74423,-21.29200,-19.79767)
df %>%
mutate(cut = cut(LONG, breaks = setx)) %>% extract(cut, c("xmin", "xmax"), "(-?\\d+),(-?\\d+)") %>% mutate(xmin = as.numeric(ymin)) %>% mutate(ymax = as.numeric(ymax))
For the ymax & ymin there was no problem doing that, but I suppose in that case it's because there is digits.
Is this the output you require?
If not, please provide a minimal example of how you wanted xmin
and xmax
to be.
library(tidyverse)
dput(head(df, n =200))
#> structure(c("function (x, df1, df2, ncp, log = FALSE) ", "{",
#> " if (missing(ncp)) ", " .Call(C_df, x, df1, df2, log)",
#> " else .Call(C_dnf, x, df1, df2, ncp, log)", "}"), .Dim = c(6L,
#> 1L), .Dimnames = list(c("1", "2", "3", "4", "5", "6"), ""), class = "noquote")
df <- structure(list(Param = c("fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "par", "par",
"par", "par", "par", "par", "par", "par", "par", "par", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"par", "par", "par", "par", "par", "par", "par", "par", "par",
"par", "salinity", "salinity", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "par", "par", "par", "par", "par", "par", "par",
"par", "par", "par", "salinity", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "salinity",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "fluorescence", "fluorescence",
"fluorescence", "fluorescence", "par", "par", "par", "par", "par",
"par", "par", "par", "par", "par", "salinity", "salinity", "salinity",
"salinity", "salinity", "salinity", "salinity", "salinity", "salinity",
"salinity", "temperature", "temperature", "temperature", "temperature",
"temperature", "temperature", "temperature", "temperature", "temperature",
"temperature", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity", "turbidity", "turbidity", "turbidity", "turbidity",
"turbidity"), ymin = c(220, 85, 0, 175, 25, 70, 225, 220, 100,
70, 100, 85, 70, 25, 175, 0, 50, 180, 220, 225, 180, 0, 220,
90, 25, 180, 100, 85, 50, 175, 25, 70, 90, 85, 85, 225, 180,
0, 90, 85, 85, 180, 0, 0, 220, 180, 225, 90, 50, 25, 200, 50,
50, 350, 220, 90, 0, 275, 25, 225, 350, 420, 480, 350, 225, 90,
90, 70, 420, 90, 0, 100, 290, 180, 85, 400, 85, 90, 70, 200,
50, 90, 300, 0, 180, 400, 90, 90, 200, 275, 200, 175, 70, 175,
100, 300, 90, 220, 50, 290, 70, 290, 200, 200, 85, 100, 100,
90, 25, 180, 290, 25, 400, 220, 200, 50, 0, 25, 275, 480, 400,
300, 220, 0, 300, 220, 175, 100, 275, 180, 50, 400, 0, 0, 420,
180, 290, 290, 90, 50, 275, 220, 275, 180, 290, 100, 175, 50,
25, 225, 0, 85, 85, 100, 100, 175, 85, 180, 275, 90, 70, 275,
90, 85, 90, 175, 180, 200, 85, 180, 50, 85, 350, 180, 50, 200,
0, 90, 25, 90, 50, 50, 180, 200, 90, 220, 50, 90, 25, 85, 200,
90, 70, 0, 90, 180, 50, 50, 70, 0), ymax = c(225, 90, 25, 180,
50, 85, 275, 225, 175, 85, 175, 90, 85, 50, 180, 25, 70, 200,
225, 275, 200, 25, 225, 100, 50, 200, 175, 90, 70, 180, 50, 85,
100, 90, 90, 275, 200, 25, 100, 90, 90, 200, 25, 25, 225, 200,
275, 100, 70, 50, 220, 70, 70, 400, 225, 100, 25, 290, 50, 275,
400, 450, 500, 400, 275, 100, 100, 85, 450, 100, 25, 175, 300,
200, 90, 420, 90, 100, 85, 220, 70, 100, 350, 25, 200, 420, 100,
100, 220, 290, 220, 180, 85, 180, 175, 350, 100, 225, 70, 300,
85, 300, 220, 220, 90, 175, 175, 100, 50, 200, 300, 50, 420,
225, 220, 70, 25, 50, 290, 500, 420, 350, 225, 25, 350, 225,
180, 175, 290, 200, 70, 420, 25, 25, 450, 200, 300, 300, 100,
70, 290, 225, 290, 200, 300, 175, 180, 70, 50, 275, 25, 90, 90,
175, 175, 180, 90, 200, 290, 100, 85, 290, 100, 90, 100, 180,
200, 220, 90, 200, 70, 90, 400, 200, 70, 220, 25, 100, 50, 100,
70, 70, 200, 220, 100, 225, 70, 100, 50, 90, 220, 100, 85, 25,
100, 200, 70, 70, 85, 25), LONG = c(-23.99908333, -24.38488333,
-23.07351667, -23.99908333, -24.9915, -24.38488333, -23.99908333,
-24.9915, -23.99908333, -23.07351667, -23.99908333, -23.07351667,
-23.07351667, -23.07351667, -23.99908333, -24.38488333, -23.99908333,
-25.15166667, -24.9915, -24.9915, -25.15166667, -24.9915, -23.99908333,
-25.15166667, -23.07351667, -24.38488333, -25.15166667, -24.38488333,
-24.9915, -24.38488333, -23.07351667, -23.99908333, -24.9915,
-24.9915, -25.15166667, -24.9915, -23.99908333, -23.99908333,
-25.15166667, -24.38488333, -23.99908333, -25.15166667, -23.07351667,
-25.15166667, -23.99908333, -24.38488333, -23.99908333, -24.38488333,
-24.38488333, -23.99908333, -26.1858, -26.1858, -19.79766667,
-25.8803, -21.292, -26.1858, -19.79766667, -24.84261667, -22.91008333,
-22.91008333, -22.91008333, -24.84261667, -24.84261667, -24.84261667,
-19.79766667, -24.84261667, -26.1858, -19.79766667, -26.1858,
-18.79291667, -19.79766667, -21.292, -25.8803, -25.8803, -25.8803,
-25.8803, -26.1858, -25.8803, -18.79291667, -26.1858, -19.79766667,
-21.292, -21.292, -26.1858, -26.1858, -25.8803, -18.79291667,
-25.8803, -26.1858, -26.1858, -21.292, -24.84261667, -25.8803,
-22.91008333, -25.8803, -24.84261667, -25.8803, -22.91008333,
-21.292, -25.8803, -25.79463333, -24.36675, -26.3169, -25.79463333,
-27.45433333, -27.45433333, -27.34373333, -27.34373333, -27.45433333,
-26.3169, -24.36675, -24.68571667, -24.36675, -25.79463333, -26.3169,
-27.34373333, -21.74423333, -24.36675, -25.79463333, -25.79463333,
-24.36675, -25.79463333, -25.79463333, -21.74423333, -26.3169,
-24.36675, -27.45433333, -24.68571667, -26.3169, -21.74423333,
-27.45433333, -26.3169, -27.45433333, -24.36675, -25.79463333,
-25.79463333, -21.74423333, -25.79463333, -26.3169, -27.34373333,
-25.79463333, -26.3169, -26.3169, -21.74423333, -24.68571667,
-21.74423333, -25.79463333, -24.36675, -25.79463333, -24.36675,
-24.23426667, -24.23426667, -22.3131, -23.79151667, -22.3131,
-23.79151667, -23.79151667, -22.3131, -22.3131, -24.23426667,
-22.3131, -22.3131, -23.79151667, -24.23426667, -24.23426667,
-22.3131, -22.3131, -22.3131, -22.3131, -23.79151667, -22.3131,
-23.79151667, -22.3131, -22.3131, -23.79151667, -22.3131, -22.3131,
-23.79151667, -22.3131, -24.23426667, -23.79151667, -22.3131,
-23.79151667, -22.3131, -22.3131, -22.3131, -22.50893333, -23.79151667,
-22.3131, -22.3131, -22.3131, -22.3131, -22.3131, -22.50893333,
-23.79151667, -23.79151667, -23.79151667, -24.23426667, -23.79151667,
-24.23426667), Transect = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L),
Value = c(0.08155852, 0.301815, 2.11627123809524, 0.08916896,
0.507806576576577, 0.376436462585034, 0.0796680773480663,
0.1813794, 0.116901057486631, 0.1968154, 2627.6870493992,
2627.7, 2627.70733333333, 2627.1951754386, 2627.7, 2627.56344086021,
2627.68923076923, 2627.69066666667, 2627.68, 2627.628, 34.5028693333333,
30.9015205882353, 34.624076, 33.471937, 34.0278530701754,
34.41674, 34.2245157543391, 33.1686533333333, 32.0401374358974,
34.3630434782609, 0.373296035242291, -1.09827823129252, -0.0840888888888889,
-0.0634604166666667, -0.414382, 0.19323, 0.3229585, 3.32400091743119,
-0.264504, -1.16256888888889, 0.49808, 301.2888, 0.546442857142857,
0.162839130434783, 1.81076, 2.19845, 1.6837679558011, 1.26615306122449,
0.814464646464646, 0.501614406779661, 0.059190285, 0.177087824120603,
0.665356180904523, 0.058553848, 0.07536708, 0.0737848, 1.16467572093023,
0.0630026533333333, 0.23709368, 0.067377656626506, 2627.74427244582,
2627.99566666667, 2628, 2628.0024, 2627.51050955414, 2628.2,
2628.2, 2627.50939597315, 2628.02584269663, 2627.9, 31.7818344186046,
34.4198116778524, 34.850228, 34.515901, 33.271, 34.8825898876404,
33.171312, 33.424846, 34.8067797297297, 34.5658145, -1.15515929648241,
-1.100712, 1.03213333333333, -0.217482105263158, 0.52464,
1.16056777777778, 2.24784, -1.114498, 0.7014795, 1.34177866666667,
1.016445, 0.45492, 0.467193333333333, 0.52288, 0.478332,
0.443222, 0.48876, 0.64078, 0.5768391959799, 0.46814, 0.0939222266666667,
0.06841773, 0.061016615, 0.06290749, 0.09016486, 0.0804777333333333,
0.125759906666667, 0.1289748, 0.174537983870968, 0.06137775,
2304.45894736842, 2231.32943548387, 2307.9145, 2289.804,
2295.2175, 2246.1025, 2265.73160377358, 2234.63024193548,
2293.86344827586, 2296.96853932584, 34.8405795, 34.6621464,
34.622442, 31.0418495283019, 34.65429, 34.74115, 34.504436,
34.2193344, 34.640094, 34.7676935, -0.0138485, 1.1815845,
-0.0814205240174673, 0.0226313043478261, 1.02302666666667,
0.5469705, 1.459401, 0.738181, -0.086665, -0.79061, 0.522664429530201,
0.56066, 0.555146666666667, 0.451445, 0.519727272727273,
0.435349397590361, 0.51554, 0.563185, 0.635352226720648,
0.566462, 0.751869561403509, 0.10155436, 0.0923774, 0.0732783297730307,
0.0726548930481283, 0.06541158, 0.08988464, 0.067170565,
0.0659365637583893, 0.106267666666667, 2248.35, 2306.9744966443,
2262.43608247423, 2236.832, 2228.29074074074, 2299.292, 2300.9735,
2303.06256410256, 2257.012, 2298.51875, 32.469601025641,
33.493826, 34.8967571428571, 34.7009225, 32.3693575, 34.7672785,
30.031902764977, 33.642694, 31.9030281512605, 33.6745559322034,
-1.635342, -1.62691897435897, 1.312134375, 1.420105, -1.28701,
1.50606, -0.82618, -1.200252, -1.57529705882353, -1.401896,
0.52944, 0.53251, 0.548925675675676, 2.22144104803493, 0.73419,
0.7245, 0.641565, 18.004535, 0.710006666666667, 3.60904385964912
)), row.names = c(NA, -200L), class = c("tbl_df", "tbl",
"data.frame"))
setx <- c(-27.75000,-27.45433,-27.34373,-26.37667,-26.31690,-26.18580,-25.88030,-25.81823,-25.79463,-25.15167,-24.99150,-24.84262,-24.68572,-24.38488,-24.36675,-24.23427,-24.01542,-23.99908,-23.79152,-23.07352,-22.91008,-22.50893,-22.31310,-21.74423,-21.29200,-19.79767)
df %>%
mutate(cut = cut(LONG, breaks = setx)) %>%
extract(cut,
c("xmin", "xmax"),
"(-?\\d+),(-?\\d+)",
remove = FALSE,
convert = TRUE)
#> # A tibble: 200 × 9
#> Param ymin ymax LONG Transect Value cut xmin xmax
#> <chr> <dbl> <dbl> <dbl> <int> <dbl> <fct> <int> <int>
#> 1 fluorescence 220 225 -24.0 1 0.0816 (-24.02,-24] 2 -24
#> 2 fluorescence 85 90 -24.4 1 0.302 (-24.69,-24.38] 69 -24
#> 3 fluorescence 0 25 -23.1 1 2.12 (-23.07,-22.91] 7 -22
#> 4 fluorescence 175 180 -24.0 1 0.0892 (-24.02,-24] 2 -24
#> 5 fluorescence 25 50 -25.0 1 0.508 (-25.15,-24.99] 15 -24
#> 6 fluorescence 70 85 -24.4 1 0.376 (-24.69,-24.38] 69 -24
#> 7 fluorescence 225 275 -24.0 1 0.0797 (-24.02,-24] 2 -24
#> 8 fluorescence 220 225 -25.0 1 0.181 (-25.15,-24.99] 15 -24
#> 9 fluorescence 100 175 -24.0 1 0.117 (-24.02,-24] 2 -24
#> 10 fluorescence 70 85 -23.1 1 0.197 (-23.07,-22.91] 7 -22
#> # … with 190 more rows
Created on 2021-11-17 by the reprex package (v2.0.1)