У меня есть df с более чем 5000 строк, вот первые 30:
df <- structure(list(date_time = structure(c(1566858600, 1566860400,
1566862200, 1566864000, 1566865800, 1566867600, 1566869400, 1566871200,
1566873000, 1566874800, 1566876600, 1566878400, 1566880200, 1566882000,
1566883800, 1566885600, 1566887400, 1566889200, 1566891000, 1566892800,
1566894600, 1566896400, 1566898200, 1566900000, 1566901800, 1566903600,
1566905400, 1566907200, 1566909000, 1566910800, 1566911795, 1566911796,
1566911797, 1566911798, 1566911799, 1566911800, 1566911801, 1566911802,
1566911803, 1566911804, 1566911805, 1566911806, 1566911807, 1566911808,
1566911809, 1566911810, 1566911811, 1566911812, 1566911813, 1566911814,
1566911815, 1566911816, 1566911817, 1566911818, 1566911819, 1566911820,
1566911821, 1566911822, 1566911823, 1566911824, 1566911825, 1566911826,
1566911827, 1566911828, 1566911829, 1566911830, 1566911831, 1566911832,
1566911833, 1566911834, 1566911835, 1566911836, 1566911837, 1566911838,
1566911839, 1566911840, 1566911841, 1566911842, 1566911843, 1566911844,
1566911845, 1566911846, 1566911847, 1566911848, 1566911849, 1566911850,
1566911851, 1566911852, 1566911853, 1566911854, 1566911855, 1566911856,
1566911857, 1566911858, 1566911859, 1566911860, 1566911861, 1566911862,
1566911863, 1566911864, 1566911865, 1566911866, 1566911867, 1566911868,
1566911869, 1566911870, 1566911871, 1566911872, 1566911873, 1566911874,
1566911875, 1566911876, 1566911877, 1566911878, 1566911879, 1566911880,
1566911881, 1566911882, 1566911883, 1566911884, 1566911885, 1566911886,
1566911887, 1566911888, 1566911889, 1566911890, 1566911891, 1566911892,
1566911893, 1566911894, 1566911895, 1566911896, 1566911897, 1566911898,
1566911899, 1566911900, 1566911901, 1566911902, 1566911903, 1566911904,
1566911905, 1566911906, 1566911907, 1566911908, 1566911909, 1566911910,
1566911911, 1566911912, 1566911913, 1566911914, 1566911915, 1566911916,
1566911917, 1566911918, 1566911919, 1566911920, 1566911921, 1566911922,
1566911923, 1566911924, 1566911925, 1566911926, 1566911927, 1566911928,
1566911929, 1566911930, 1566911931, 1566911932, 1566911933, 1566911934,
1566911935, 1566911936, 1566911937, 1566911938, 1566911939, 1566911940,
1566911941, 1566911942, 1566911943, 1566911944, 1566911945, 1566911946,
1566911947, 1566911948, 1566911949, 1566911950, 1566911951, 1566911952,
1566911953, 1566911954, 1566911955, 1566911956, 1566911957, 1566911958,
1566911959, 1566911960, 1566911961, 1566911962, 1566911963, 1566911964,
1566911965, 1566911966, 1566911967, 1566911968, 1566911969, 1566911970,
1566911971, 1566911972, 1566911973, 1566911974, 1566911975, 1566911976,
1566911977, 1566911978, 1566911979, 1566911980, 1566911981, 1566911982,
1566911983, 1566911984, 1566911985, 1566911986, 1566911987, 1566911988,
1566911989, 1566911990, 1566911991, 1566911992, 1566911993, 1566911994,
1566911995, 1566911996, 1566911997, 1566911998, 1566911999, 1566912001,
1566912002, 1566912003, 1566912004, 1566912005, 1566912006, 1566912007,
1566912008, 1566912009, 1566912010, 1566912011, 1566912012, 1566912013,
1566912014, 1566912015, 1566912016, 1566912017, 1566912018, 1566912019,
1566912020, 1566912021, 1566912022, 1566912023, 1566912024, 1566912025,
1566912026, 1566912027, 1566912028, 1566912029, 1566912030, 1566912031,
1566912032, 1566912033, 1566912034, 1566912035, 1566912036, 1566912539,
1566912540, 1566912541, 1566912542, 1566912543, 1566912544, 1566912545,
1566912546, 1566912547, 1566912548, 1566912549, 1566912550, 1566912551,
1566912552, 1566912553, 1566912554, 1566912555, 1566912556, 1566912557,
1566912558, 1566912559, 1566912560, 1566912561, 1566912562, 1566912563,
1566912564, 1566912565, 1566912566, 1566912567, 1566912568, 1566912569,
1566912570, 1566912571, 1566912572, 1566912573, 1566912574, 1566912575,
1566912576, 1566912577, 1566912578, 1566912579, 1566912580, 1566912581,
1566912582, 1566912583, 1566912584, 1566912585, 1566912586, 1566912587,
1566912588, 1566912589, 1566912590, 1566912591, 1566912592, 1566912593,
1566912594, 1566912595, 1566912596, 1566912597, 1566912598, 1566912599,
1566912600, 1566912601, 1566912602, 1566912603, 1566912604, 1566912605,
1566912606, 1566912607, 1566912608, 1566912609, 1566912610, 1566912611,
1566912612, 1566912613, 1566912614, 1566912615, 1566912616, 1566912617,
1566912618, 1566912619, 1566912620, 1566912621, 1566912622, 1566912623,
1566912624, 1566912625, 1566912626, 1566912627, 1566912628, 1566912629,
1566912630, 1566912631, 1566912632, 1566912633, 1566912634, 1566912635,
1566912636, 1566912637, 1566912638, 1566912639, 1566912640, 1566912641,
1566912642, 1566912643, 1566912644, 1566912645, 1566912646, 1566912647,
1566912648, 1566912649, 1566912650, 1566912651, 1566912652, 1566912653,
1566912654, 1566912655, 1566912656, 1566912657, 1566912658, 1566912659,
1566912660, 1566912661, 1566912662, 1566912663, 1566912664, 1566912665,
1566912666, 1566912667, 1566912668, 1566912669, 1566912670, 1566912671,
1566912672, 1566912673, 1566912674, 1566912675, 1566912676, 1566912677,
1566912678, 1566912679, 1566912680, 1566912681, 1566912682, 1566912683,
1566912684, 1566912685, 1566912686, 1566912687, 1566912688, 1566912689,
1566912690, 1566912691, 1566912692, 1566912693, 1566912694, 1566912695,
1566912696, 1566912697, 1566912698, 1566912699, 1566912700, 1566912701,
1566912702, 1566912703, 1566912704, 1566912705, 1566912706, 1566912707,
1566912708, 1566912709, 1566912710, 1566912711, 1566912712, 1566912713,
1566912714, 1566912715, 1566912716, 1566912717, 1566912718, 1566912719,
1566912720, 1566912721, 1566912722, 1566912723, 1566912724, 1566912725,
1566912726, 1566912727, 1566912728, 1566912729, 1566912730, 1566912731,
1566912732, 1566912733, 1566912734, 1566912735, 1566912736, 1566912737,
1566912738, 1566912739, 1566912740, 1566912741, 1566912742, 1566912743,
1566912744, 1566912745, 1566912746, 1566912747, 1566912748, 1566912749,
1566912750, 1566912751, 1566912752, 1566912753, 1566912754, 1566912755,
1566912756, 1566912757, 1566912758, 1566912759, 1566912760, 1566912761,
1566912762, 1566912763, 1566912764, 1566912765, 1566912766, 1566912767
), class = c("POSIXct", "POSIXt"), tzone = "UTC"), Q_salt = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.22327550442228, 0.22327550442228, 0.22327550442228, 0.22327550442228,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355, 0.267994231052355, 0.267994231052355, 0.267994231052355,
0.267994231052355), waterlevel = c(0.361875637104995, 0.36697247706422,
0.361875637104995, 0.343527013251783, 0.347604485219164, 0.325178389398573,
0.334352701325178, 0.320081549439347, 0.305810397553517, 0.306829765545362,
0.300713557594292, 0.300713557594292, 0.289500509683996, 0.289500509683997,
0.275229357798165, 0.28032619775739, 0.271151885830785, 0.266055045871559,
0.28032619775739, 0.29255861365953, 0.322120285423038, 0.363914373088685,
0.405708460754333, 0.448521916411825, 0.495412844036697, 0.508664627930683,
0.512742099898064, 0.55249745158002, 0.573904179408766, 0.567787971457695,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.529051987767584,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA), ID = c(NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12), minute = c(30L,
0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L,
0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L, 0L, 30L,
0L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 30L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA), mod = c(1350, 1380, 1410, 0, 30,
60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420,
450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 810, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -500L))
Это вывод со строками, которые лучше всего иллюстрируют проблемы:
# A tibble: 5,837 x 6
date_time Q_salt waterlevel ID minute mod
<dttm> <dbl> <dbl> <dbl> <int> <dbl>
1 2019-08-26 22:30:00 NA 0.362 NA 30 1350
2 2019-08-26 23:00:00 NA 0.367 NA 0 1380
3 2019-08-26 23:30:00 NA 0.362 NA 30 1410
...
514 2019-08-27 13:33:02 0.268 NA 12 NA NA
515 2019-08-27 13:33:03 0.268 NA 12 NA NA
516 2019-08-27 13:33:04 0.268 NA 12 NA NA
517 2019-08-27 13:33:05 0.268 NA 12 NA NA
518 2019-08-27 13:33:06 0.268 NA 12 NA NA
519 2019-08-27 14:00:00 NA 0.523 NA 0 840
520 2019-08-27 14:30:00 NA 0.505 NA 30 870
521 2019-08-27 15:00:00 NA 0.465 NA 0 900
522 2019-08-27 15:30:00 NA 0.471 NA 30 930
523 2019-08-27 16:00:00 NA 0.473 NA 0 960
524 2019-08-27 16:06:03 1.49 NA 13 NA NA
525 2019-08-27 16:06:04 1.49 NA 13 NA NA
526 2019-08-27 16:06:05 1.49 NA 13 NA NA
527 2019-08-27 16:06:06 1.49 NA 13 NA NA
Проблема в том, что измерения соли (Q_salt
) выполняются каждую секунду, а измерения waterlevel
- каждые 30 минут.
Поскольку измерения Q_salt
не пересекаются каждый раз с измерением waterlevel
(поскольку они короче 30 минут), я хотел бы расширить раздел waterlevel
.
Таким образом, waterlevel
столбцы заполняются «вторым образом» с ближайшими waterlevel
значениями . В итоге это выглядит примерно так:
523 2019-08-27 16:00:00 NA 0.473 NA 0 960
...
xxx 2019-08-27 16:06:03 1.49 0.473 13 NA NA
xxx 2019-08-27 16:06:04 1.49 0.473 13 NA NA
xxx 2019-08-27 16:06:05 1.49 0.473 13 NA NA
xxx 2019-08-27 16:06:06 1.49 0.473 13 NA NA
...
xxx 2019-08-27 16:14:56 NA 0.473 NA 0 960
xxx 2019-08-27 16:14:57 NA 0.473 13 NA NA
xxx 2019-08-27 16:14:58 NA 0.473 13 NA NA
xxx 2019-08-27 16:14:59 NA 0.473 13 NA NA
xxx 2019-08-27 16:15:00 NA "waterlevel value of 16:30:00"
То, что я пробовал до сих пор
df %>%
complete(date_time = seq.POSIXt(min(date_time), max(date_time), by = "sec")) %>%
fill(waterlevel)
, но это заполняет waterlevel
неправильными значениями.