R语言 从时间序列数据中提取峰值/局部最大值和谷值/局部最小值

vnjpjtjt  于 2023-07-31  发布在  其他
关注(0)|答案(2)|浏览(135)

我试图从时间序列数据中提取峰值(局部最大值)和谷值(局部最小值),以供进一步分析。
我尝试了Excel,但它没有捕获这些属性,因为我想(见图)。带实心圆的正方形是我想要的峰和谷。由黑色箭头指示的空方块描绘了Excel未捕获的数据谷。
如放大的插图所示,我想将数据从填充圆的正方形提取到空正方形。再次感谢。虽然我是一个使用R的绿色,但我相信我可以在R中做这个提取。
Excel中的峰_谷


的数据
如何使用R进行提取?Python可复制代码也很受欢迎。

time barometer
1   6/16/2023 16:30      0.17
2   6/16/2023 17:00      0.17
3   6/16/2023 17:30      0.16
4   6/16/2023 18:00      0.16
5   6/16/2023 18:30      0.16
6   6/16/2023 19:00      0.17
7   6/16/2023 19:30      0.19
8   6/16/2023 20:00      0.19
9   6/16/2023 20:30      0.18
10  6/16/2023 21:00      0.18
11  6/16/2023 21:30      0.18
12  6/16/2023 22:00      0.18
13  6/16/2023 22:30      0.18
14  6/16/2023 23:00      0.18
15  6/16/2023 23:30      0.18
16   6/17/2023 0:00      0.18
17   6/17/2023 0:30      0.18
18   6/17/2023 1:00      0.18
19   6/17/2023 1:30      0.18
20   6/17/2023 2:00      0.18
21   6/17/2023 2:30      0.18
22   6/17/2023 3:00      0.18
23   6/17/2023 3:30      0.18
24   6/17/2023 4:00      0.18
25   6/17/2023 4:30      0.18
26   6/17/2023 5:00      0.18
27   6/17/2023 5:30      0.18
28   6/17/2023 6:00      0.18
29   6/17/2023 6:30      0.18
30   6/17/2023 7:00      0.18
31   6/17/2023 7:30      0.18
32   6/17/2023 8:00      0.17
33   6/17/2023 8:30      0.17
34   6/17/2023 9:00      0.17
35   6/17/2023 9:30      0.17
36  6/17/2023 10:00      0.17
37  6/17/2023 10:30      0.17
38  6/17/2023 11:00      0.17
39  6/17/2023 11:30      0.17
40  6/17/2023 12:00      0.16
41  6/17/2023 12:30      0.17
42  6/17/2023 13:00      0.17
43  6/17/2023 13:30      0.16
44  6/17/2023 14:00      0.16
45  6/17/2023 14:30      0.16
46  6/17/2023 15:00      0.16
47  6/17/2023 15:30      0.16
48  6/17/2023 16:00      0.16
49  6/17/2023 16:30      0.16
50  6/17/2023 17:00      0.16
51  6/17/2023 17:30      0.16
52  6/17/2023 18:00      0.16
53  6/17/2023 18:30      0.15
54  6/17/2023 19:00      0.15
55  6/17/2023 19:30      0.15
56  6/17/2023 20:00      0.15
57  6/17/2023 20:30      0.15
58  6/17/2023 21:00      0.15
59  6/17/2023 21:30      0.15
60  6/17/2023 22:00      0.15
61  6/17/2023 22:30      0.15
62  6/17/2023 23:00      0.15
63  6/17/2023 23:30      0.15
64   6/18/2023 0:00      0.15
65   6/18/2023 0:30      0.15
66   6/18/2023 1:00      0.15
67   6/18/2023 1:30      0.15
68   6/18/2023 2:00      0.15
69   6/18/2023 2:30      0.15
70   6/18/2023 3:00      0.15
71   6/18/2023 3:30      0.15
72   6/18/2023 4:00      0.15
73   6/18/2023 4:30      0.15
74   6/18/2023 5:00      0.15
75   6/18/2023 5:30      0.15
76   6/18/2023 6:00      0.15
77   6/18/2023 6:30      0.15
78   6/18/2023 7:00      0.14
79   6/18/2023 7:30      0.14
80   6/18/2023 8:00      0.14
81   6/18/2023 8:30      0.14
82   6/18/2023 9:00      0.14
83   6/18/2023 9:30      0.14
84  6/18/2023 10:00      0.14
85  6/18/2023 10:30      0.14
86  6/18/2023 11:00      0.14
87  6/18/2023 11:30      0.14
88  6/18/2023 12:00      0.14
89  6/18/2023 12:30      0.14
90  6/18/2023 13:00      0.14
91  6/18/2023 13:30      0.14
92  6/18/2023 14:00      0.14
93  6/18/2023 14:30      0.14
94  6/18/2023 15:00      0.14
95  6/18/2023 15:30      0.14
96  6/18/2023 16:00      0.14
97  6/18/2023 16:30      0.14
98  6/18/2023 17:00      0.14
99  6/18/2023 17:30      0.14
100 6/18/2023 18:00      0.14
101 6/18/2023 18:30      0.14
102 6/18/2023 19:00      0.14
103 6/18/2023 19:30      0.14
104 6/18/2023 20:00      0.14
105 6/18/2023 20:30      0.14
106 6/18/2023 21:00      0.14
107 6/18/2023 21:30      0.13
108 6/18/2023 22:00      0.13
109 6/18/2023 22:30      0.13
110 6/18/2023 23:00      0.13
111 6/18/2023 23:30      0.13
112  6/19/2023 0:00      0.13
113  6/19/2023 0:30      0.13
114  6/19/2023 1:00      0.13
115  6/19/2023 1:30      0.13
116  6/19/2023 2:00      0.13
117  6/19/2023 2:30      0.13
118  6/19/2023 3:00      0.13
119  6/19/2023 3:30      0.13
120  6/19/2023 4:00      0.13
121  6/19/2023 4:30      0.13
122  6/19/2023 5:00      0.13
123  6/19/2023 5:30      0.13
124  6/19/2023 6:00      0.13
125  6/19/2023 6:30      0.13
126  6/19/2023 7:00      0.13
127  6/19/2023 7:30      0.13
128  6/19/2023 8:00      0.13
129  6/19/2023 8:30      0.13
130  6/19/2023 9:00      0.13
131  6/19/2023 9:30      0.13
132 6/19/2023 10:00      0.13
133 6/19/2023 10:30      0.13
134 6/19/2023 11:00      0.13
135 6/19/2023 11:30      0.13
136 6/19/2023 12:00      0.13
137 6/19/2023 12:30      0.12
138 6/19/2023 13:00      0.13
139 6/19/2023 13:30      0.12
140 6/19/2023 14:00      0.12
141 6/19/2023 14:30      0.12
142 6/19/2023 15:00      0.12
143 6/19/2023 15:30      0.12
144 6/19/2023 16:00      0.12
145 6/19/2023 16:30      0.12
146 6/19/2023 17:00      0.12
147 6/19/2023 17:30      0.12
148 6/19/2023 18:00      0.12
149 6/19/2023 18:30      0.11
150 6/19/2023 19:00      0.11
151 6/19/2023 19:30      0.11
152 6/19/2023 20:00      0.11
153 6/19/2023 20:30      0.11
154 6/19/2023 21:00      0.11
155 6/19/2023 21:30      0.11
156 6/19/2023 22:00      0.11
157 6/19/2023 22:30      0.11
158 6/19/2023 23:00      0.11
159 6/19/2023 23:30      0.11
160  6/20/2023 0:00      0.11
161  6/20/2023 0:30      0.11
162  6/20/2023 1:00      0.11
163  6/20/2023 1:30      0.11
164  6/20/2023 2:00      0.11
165  6/20/2023 2:30      0.11
166  6/20/2023 3:00      0.11
167  6/20/2023 3:30      0.11
168  6/20/2023 4:00      0.11
169  6/20/2023 4:30      0.11
170  6/20/2023 5:00      0.11
171  6/20/2023 5:30      0.11
172  6/20/2023 6:00      0.11
173  6/20/2023 6:30      0.11
174  6/20/2023 7:00      0.11
175  6/20/2023 7:30      0.11
176  6/20/2023 8:00      0.10
177  6/20/2023 8:30      0.10
178  6/20/2023 9:00      0.10
179  6/20/2023 9:30      0.10
180 6/20/2023 10:00      0.10
181 6/20/2023 10:30      0.10
182 6/20/2023 11:00      0.10
183 6/20/2023 11:30      0.10
184 6/20/2023 12:00      0.10
185 6/20/2023 12:30      0.10
186 6/20/2023 13:00      0.10
187 6/20/2023 13:30      0.10
188 6/20/2023 14:00      0.10
189 6/20/2023 14:30      0.10
190 6/20/2023 15:00      0.10
191 6/20/2023 15:30      0.09
192 6/20/2023 16:00      0.09
193 6/20/2023 16:30      0.09
194 6/20/2023 17:00      0.09
195 6/20/2023 17:30      0.09
196 6/20/2023 18:00      0.09
197 6/20/2023 18:30      0.09
198 6/20/2023 19:00      0.09
199 6/20/2023 19:30      0.09
200 6/20/2023 20:00      0.09
201 6/20/2023 20:30      0.09
202 6/20/2023 21:00      0.08
203 6/20/2023 21:30      0.08
204 6/20/2023 22:00      0.08
205 6/20/2023 22:30      0.08
206 6/20/2023 23:00      0.08
207 6/20/2023 23:30      0.08
208  6/21/2023 0:00      0.08
209  6/21/2023 0:30      0.08
210  6/21/2023 1:00      0.08
211  6/21/2023 1:30      0.08
212  6/21/2023 2:00      0.08
213  6/21/2023 2:30      0.08
214  6/21/2023 3:00      0.08
215  6/21/2023 3:30      0.08
216  6/21/2023 4:00      0.08
217  6/21/2023 4:30      0.08
218  6/21/2023 5:00      0.08
219  6/21/2023 5:30      0.08
220  6/21/2023 6:00      0.08
221  6/21/2023 6:30      0.08
222  6/21/2023 7:00      0.08
223  6/21/2023 7:30      0.08
224  6/21/2023 8:00      0.08
225  6/21/2023 8:30      0.08
226  6/21/2023 9:00      0.08
227  6/21/2023 9:30      0.08
228 6/21/2023 10:00      0.08
229 6/21/2023 10:30      0.08
230 6/21/2023 11:00      0.08
231 6/21/2023 11:30      0.08
232 6/21/2023 12:00      0.08
233 6/21/2023 12:30      0.08
234 6/21/2023 13:00      0.08
235 6/21/2023 13:30      0.08
236 6/21/2023 14:00      0.08
237 6/21/2023 14:30      0.08
238 6/21/2023 15:00      0.08
239 6/21/2023 15:30      0.08
240 6/21/2023 16:00      0.09
241 6/21/2023 16:30      0.08
242 6/21/2023 17:00      0.08
243 6/21/2023 17:30      0.08
244 6/21/2023 18:00      0.08
245 6/21/2023 18:30      0.07
246 6/21/2023 19:00      0.08
247 6/21/2023 19:30      0.07
248 6/21/2023 20:00      0.07
249 6/21/2023 20:30      0.07
250 6/21/2023 21:00      0.07
251 6/21/2023 21:30      0.07
252 6/21/2023 22:00      0.07
253 6/21/2023 22:30      0.07
254 6/21/2023 23:00      0.07
255 6/21/2023 23:30      0.07
256  6/22/2023 0:00      0.07
257  6/22/2023 0:30      0.07
258  6/22/2023 1:00      0.07
259  6/22/2023 1:30      0.07
260  6/22/2023 2:00      0.07
261  6/22/2023 2:30      0.07
262  6/22/2023 3:00      0.07
263  6/22/2023 3:30      0.07
264  6/22/2023 4:00      0.07
265  6/22/2023 4:30      0.07
266  6/22/2023 5:00      0.07
267  6/22/2023 5:30      0.07
268  6/22/2023 6:00      0.07
269  6/22/2023 6:30      0.07
270  6/22/2023 7:00      0.07
271  6/22/2023 7:30      0.07
272  6/22/2023 8:00      0.07
273  6/22/2023 8:30      0.07
274  6/22/2023 9:00      0.07
275  6/22/2023 9:30      0.06
276 6/22/2023 10:00      0.07
277 6/22/2023 10:30      0.06
278 6/22/2023 11:00      0.07
279 6/22/2023 11:30      0.06
280 6/22/2023 12:00      0.06
281 6/22/2023 12:30      0.06
282 6/22/2023 13:00      0.06
283 6/22/2023 13:30      0.06
284 6/22/2023 14:00      0.06
285 6/22/2023 14:30      0.06
286 6/22/2023 15:00      0.06
287 6/22/2023 15:30      0.06
288 6/22/2023 16:00      0.06
289 6/22/2023 16:30      0.06
290 6/22/2023 17:00      0.06
291 6/22/2023 17:30      0.05
292 6/22/2023 18:00      0.05
293 6/22/2023 18:30      0.05
294 6/22/2023 19:00      0.05
295 6/22/2023 19:30      0.05
296 6/22/2023 20:00      0.05
297 6/22/2023 20:30      0.05
298 6/22/2023 21:00      0.05
299 6/22/2023 21:30      0.05
300 6/22/2023 22:00      0.05
301 6/22/2023 22:30      0.05
302 6/22/2023 23:00      0.05
303 6/22/2023 23:30      0.05
304  6/23/2023 0:00      0.05
305  6/23/2023 0:30      0.05
306  6/23/2023 1:00      0.05
307  6/23/2023 1:30      0.05
308  6/23/2023 2:00      0.05
309  6/23/2023 2:30      0.05
310  6/23/2023 3:00      0.05
311  6/23/2023 3:30      0.05
312  6/23/2023 4:00      0.05
313  6/23/2023 4:30      0.05
314  6/23/2023 5:00      0.05
315  6/23/2023 5:30      0.05
316  6/23/2023 6:00      0.05
317  6/23/2023 6:30      0.05
318  6/23/2023 7:00      0.05
319  6/23/2023 7:30      0.05
320  6/23/2023 8:00      0.05
321  6/23/2023 8:30      0.05
322  6/23/2023 9:00      0.05
323  6/23/2023 9:30      0.05
324 6/23/2023 10:00      0.04
325 6/23/2023 10:30      0.04
326 6/23/2023 11:00      0.05
327 6/23/2023 11:30      0.04
328 6/23/2023 12:00      0.04
329 6/23/2023 12:30      0.04
330 6/23/2023 13:00      0.04
331 6/23/2023 13:30      0.05
332 6/23/2023 14:00      0.04
333 6/23/2023 14:30      0.04
334 6/23/2023 15:00      0.05
335 6/23/2023 15:30      0.04
336 6/23/2023 16:00      0.04
337 6/23/2023 16:30      0.04
338 6/23/2023 17:00      0.04
339 6/23/2023 17:30      0.04
340 6/23/2023 18:00      0.15
341 6/23/2023 18:30      1.73
342 6/23/2023 19:00      1.44
343 6/23/2023 19:30      0.74
344 6/23/2023 20:00      0.66
345 6/23/2023 20:30      0.62
346 6/23/2023 21:00      0.60
347 6/23/2023 21:30      0.59
348 6/23/2023 22:00      0.58
349 6/23/2023 22:30      0.57

字符串

llycmphe

llycmphe1#

您正在寻找的特定点似乎发生在突然向上或向下变化的地方。如果连续几次快速增加或减少,则需要其中的第一个。我们需要做的第一件事是将time列转换为实际的日期时间:

dat$time <- as.POSIXct(dat$time, format = "%m/%d/%Y %H:%S")

字符串
现在我们得到连续测量之间的变化:

changes <- c(diff(dat$barometer), 0)


现在,我们执行游程编码,以确定值的变化是否超过0.1。我们需要从积极和消极两方面来做这件事:

pos_change <- rle(abs(changes) > 0.1 & sign(changes) == 1)
neg_change <- rle(abs(changes) > 0.1 & sign(changes) == -1)


现在我们找到每个运行编码的开始:

pos <- with(pos_change, cumsum(lengths)[values == "TRUE"]) - 1
neg <- with(neg_change, cumsum(lengths)[values == "TRUE"]) - 1


现在,我们使用它来子集我们的原始 Dataframe ,以获得我们的最终结果:

changes <- dat[sort(c(pos, neg)),]


最后的结果看起来像这样:

changes
#>                    time barometer
#> 339 2023-06-23 17:00:30      0.04
#> 341 2023-06-23 18:00:30      1.73

让我们绘制原始数据,并用红色覆盖changes

plot(dat, type = "l")
points(changes, col = "red")

x1c 0d1x的数据
创建于2023-07-29,使用reprex v2.0.2

可复制数据

dat <- structure(list(time = c("6/16/2023 16:30", "6/16/2023 17:00", 
"6/16/2023 17:30", "6/16/2023 18:00", "6/16/2023 18:30", "6/16/2023 19:00", 
"6/16/2023 19:30", "6/16/2023 20:00", "6/16/2023 20:30", "6/16/2023 21:00", 
"6/16/2023 21:30", "6/16/2023 22:00", "6/16/2023 22:30", "6/16/2023 23:00", 
"6/16/2023 23:30", "6/17/2023 0:00", "6/17/2023 0:30", "6/17/2023 1:00", 
"6/17/2023 1:30", "6/17/2023 2:00", "6/17/2023 2:30", "6/17/2023 3:00", 
"6/17/2023 3:30", "6/17/2023 4:00", "6/17/2023 4:30", "6/17/2023 5:00", 
"6/17/2023 5:30", "6/17/2023 6:00", "6/17/2023 6:30", "6/17/2023 7:00", 
"6/17/2023 7:30", "6/17/2023 8:00", "6/17/2023 8:30", "6/17/2023 9:00", 
"6/17/2023 9:30", "6/17/2023 10:00", "6/17/2023 10:30", "6/17/2023 11:00", 
"6/17/2023 11:30", "6/17/2023 12:00", "6/17/2023 12:30", "6/17/2023 13:00", 
"6/17/2023 13:30", "6/17/2023 14:00", "6/17/2023 14:30", "6/17/2023 15:00", 
"6/17/2023 15:30", "6/17/2023 16:00", "6/17/2023 16:30", "6/17/2023 17:00", 
"6/17/2023 17:30", "6/17/2023 18:00", "6/17/2023 18:30", "6/17/2023 19:00", 
"6/17/2023 19:30", "6/17/2023 20:00", "6/17/2023 20:30", "6/17/2023 21:00", 
"6/17/2023 21:30", "6/17/2023 22:00", "6/17/2023 22:30", "6/17/2023 23:00", 
"6/17/2023 23:30", "6/18/2023 0:00", "6/18/2023 0:30", "6/18/2023 1:00", 
"6/18/2023 1:30", "6/18/2023 2:00", "6/18/2023 2:30", "6/18/2023 3:00", 
"6/18/2023 3:30", "6/18/2023 4:00", "6/18/2023 4:30", "6/18/2023 5:00", 
"6/18/2023 5:30", "6/18/2023 6:00", "6/18/2023 6:30", "6/18/2023 7:00", 
"6/18/2023 7:30", "6/18/2023 8:00", "6/18/2023 8:30", "6/18/2023 9:00", 
"6/18/2023 9:30", "6/18/2023 10:00", "6/18/2023 10:30", "6/18/2023 11:00", 
"6/18/2023 11:30", "6/18/2023 12:00", "6/18/2023 12:30", "6/18/2023 13:00", 
"6/18/2023 13:30", "6/18/2023 14:00", "6/18/2023 14:30", "6/18/2023 15:00", 
"6/18/2023 15:30", "6/18/2023 16:00", "6/18/2023 16:30", "6/18/2023 17:00", 
"6/18/2023 17:30", "6/18/2023 18:00", "6/18/2023 18:30", "6/18/2023 19:00", 
"6/18/2023 19:30", "6/18/2023 20:00", "6/18/2023 20:30", "6/18/2023 21:00", 
"6/18/2023 21:30", "6/18/2023 22:00", "6/18/2023 22:30", "6/18/2023 23:00", 
"6/18/2023 23:30", "6/19/2023 0:00", "6/19/2023 0:30", "6/19/2023 1:00", 
"6/19/2023 1:30", "6/19/2023 2:00", "6/19/2023 2:30", "6/19/2023 3:00", 
"6/19/2023 3:30", "6/19/2023 4:00", "6/19/2023 4:30", "6/19/2023 5:00", 
"6/19/2023 5:30", "6/19/2023 6:00", "6/19/2023 6:30", "6/19/2023 7:00", 
"6/19/2023 7:30", "6/19/2023 8:00", "6/19/2023 8:30", "6/19/2023 9:00", 
"6/19/2023 9:30", "6/19/2023 10:00", "6/19/2023 10:30", "6/19/2023 11:00", 
"6/19/2023 11:30", "6/19/2023 12:00", "6/19/2023 12:30", "6/19/2023 13:00", 
"6/19/2023 13:30", "6/19/2023 14:00", "6/19/2023 14:30", "6/19/2023 15:00", 
"6/19/2023 15:30", "6/19/2023 16:00", "6/19/2023 16:30", "6/19/2023 17:00", 
"6/19/2023 17:30", "6/19/2023 18:00", "6/19/2023 18:30", "6/19/2023 19:00", 
"6/19/2023 19:30", "6/19/2023 20:00", "6/19/2023 20:30", "6/19/2023 21:00", 
"6/19/2023 21:30", "6/19/2023 22:00", "6/19/2023 22:30", "6/19/2023 23:00", 
"6/19/2023 23:30", "6/20/2023 0:00", "6/20/2023 0:30", "6/20/2023 1:00", 
"6/20/2023 1:30", "6/20/2023 2:00", "6/20/2023 2:30", "6/20/2023 3:00", 
"6/20/2023 3:30", "6/20/2023 4:00", "6/20/2023 4:30", "6/20/2023 5:00", 
"6/20/2023 5:30", "6/20/2023 6:00", "6/20/2023 6:30", "6/20/2023 7:00", 
"6/20/2023 7:30", "6/20/2023 8:00", "6/20/2023 8:30", "6/20/2023 9:00", 
"6/20/2023 9:30", "6/20/2023 10:00", "6/20/2023 10:30", "6/20/2023 11:00", 
"6/20/2023 11:30", "6/20/2023 12:00", "6/20/2023 12:30", "6/20/2023 13:00", 
"6/20/2023 13:30", "6/20/2023 14:00", "6/20/2023 14:30", "6/20/2023 15:00", 
"6/20/2023 15:30", "6/20/2023 16:00", "6/20/2023 16:30", "6/20/2023 17:00", 
"6/20/2023 17:30", "6/20/2023 18:00", "6/20/2023 18:30", "6/20/2023 19:00", 
"6/20/2023 19:30", "6/20/2023 20:00", "6/20/2023 20:30", "6/20/2023 21:00", 
"6/20/2023 21:30", "6/20/2023 22:00", "6/20/2023 22:30", "6/20/2023 23:00", 
"6/20/2023 23:30", "6/21/2023 0:00", "6/21/2023 0:30", "6/21/2023 1:00", 
"6/21/2023 1:30", "6/21/2023 2:00", "6/21/2023 2:30", "6/21/2023 3:00", 
"6/21/2023 3:30", "6/21/2023 4:00", "6/21/2023 4:30", "6/21/2023 5:00", 
"6/21/2023 5:30", "6/21/2023 6:00", "6/21/2023 6:30", "6/21/2023 7:00", 
"6/21/2023 7:30", "6/21/2023 8:00", "6/21/2023 8:30", "6/21/2023 9:00", 
"6/21/2023 9:30", "6/21/2023 10:00", "6/21/2023 10:30", "6/21/2023 11:00", 
"6/21/2023 11:30", "6/21/2023 12:00", "6/21/2023 12:30", "6/21/2023 13:00", 
"6/21/2023 13:30", "6/21/2023 14:00", "6/21/2023 14:30", "6/21/2023 15:00", 
"6/21/2023 15:30", "6/21/2023 16:00", "6/21/2023 16:30", "6/21/2023 17:00", 
"6/21/2023 17:30", "6/21/2023 18:00", "6/21/2023 18:30", "6/21/2023 19:00", 
"6/21/2023 19:30", "6/21/2023 20:00", "6/21/2023 20:30", "6/21/2023 21:00", 
"6/21/2023 21:30", "6/21/2023 22:00", "6/21/2023 22:30", "6/21/2023 23:00", 
"6/21/2023 23:30", "6/22/2023 0:00", "6/22/2023 0:30", "6/22/2023 1:00", 
"6/22/2023 1:30", "6/22/2023 2:00", "6/22/2023 2:30", "6/22/2023 3:00", 
"6/22/2023 3:30", "6/22/2023 4:00", "6/22/2023 4:30", "6/22/2023 5:00", 
"6/22/2023 5:30", "6/22/2023 6:00", "6/22/2023 6:30", "6/22/2023 7:00", 
"6/22/2023 7:30", "6/22/2023 8:00", "6/22/2023 8:30", "6/22/2023 9:00", 
"6/22/2023 9:30", "6/22/2023 10:00", "6/22/2023 10:30", "6/22/2023 11:00", 
"6/22/2023 11:30", "6/22/2023 12:00", "6/22/2023 12:30", "6/22/2023 13:00", 
"6/22/2023 13:30", "6/22/2023 14:00", "6/22/2023 14:30", "6/22/2023 15:00", 
"6/22/2023 15:30", "6/22/2023 16:00", "6/22/2023 16:30", "6/22/2023 17:00", 
"6/22/2023 17:30", "6/22/2023 18:00", "6/22/2023 18:30", "6/22/2023 19:00", 
"6/22/2023 19:30", "6/22/2023 20:00", "6/22/2023 20:30", "6/22/2023 21:00", 
"6/22/2023 21:30", "6/22/2023 22:00", "6/22/2023 22:30", "6/22/2023 23:00", 
"6/22/2023 23:30", "6/23/2023 0:00", "6/23/2023 0:30", "6/23/2023 1:00", 
"6/23/2023 1:30", "6/23/2023 2:00", "6/23/2023 2:30", "6/23/2023 3:00", 
"6/23/2023 3:30", "6/23/2023 4:00", "6/23/2023 4:30", "6/23/2023 5:00", 
"6/23/2023 5:30", "6/23/2023 6:00", "6/23/2023 6:30", "6/23/2023 7:00", 
"6/23/2023 7:30", "6/23/2023 8:00", "6/23/2023 8:30", "6/23/2023 9:00", 
"6/23/2023 9:30", "6/23/2023 10:00", "6/23/2023 10:30", "6/23/2023 11:00", 
"6/23/2023 11:30", "6/23/2023 12:00", "6/23/2023 12:30", "6/23/2023 13:00", 
"6/23/2023 13:30", "6/23/2023 14:00", "6/23/2023 14:30", "6/23/2023 15:00", 
"6/23/2023 15:30", "6/23/2023 16:00", "6/23/2023 16:30", "6/23/2023 17:00", 
"6/23/2023 17:30", "6/23/2023 18:00", "6/23/2023 18:30", "6/23/2023 19:00", 
"6/23/2023 19:30", "6/23/2023 20:00", "6/23/2023 20:30", "6/23/2023 21:00", 
"6/23/2023 21:30", "6/23/2023 22:00", "6/23/2023 22:30"), barometer = c(0.17, 
0.17, 0.16, 0.16, 0.16, 0.17, 0.19, 0.19, 0.18, 0.18, 0.18, 0.18, 
0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 
0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.17, 0.17, 0.17, 
0.17, 0.17, 0.17, 0.17, 0.17, 0.16, 0.17, 0.17, 0.16, 0.16, 0.16, 
0.16, 0.16, 0.16, 0.16, 0.16, 0.16, 0.16, 0.15, 0.15, 0.15, 0.15, 
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.14, 
0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 
0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 
0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 
0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 
0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 
0.13, 0.13, 0.13, 0.12, 0.13, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 
0.12, 0.12, 0.12, 0.12, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 
0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 
0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.1, 0.1, 
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 
0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 
0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 
0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 
0.08, 0.08, 0.08, 0.08, 0.08, 0.09, 0.08, 0.08, 0.08, 0.08, 0.07, 
0.08, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 
0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 
0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.06, 0.07, 0.06, 0.07, 
0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 
0.06, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 
0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 
0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 
0.05, 0.04, 0.04, 0.05, 0.04, 0.04, 0.04, 0.04, 0.05, 0.04, 0.04, 
0.05, 0.04, 0.04, 0.04, 0.04, 0.04, 0.15, 1.73, 1.44, 0.74, 0.66, 
0.62, 0.6, 0.59, 0.58, 0.57)), row.names = c(NA, -349L), class = "data.frame")
6kkfgxo0

6kkfgxo02#

@AllanCameron:感谢您的大力协助。我运行了代码,它工作了。然而,我需要稍微调整一下,以便那些“变化”点与波峰和波谷相吻合。我只对图中下降部分的数据点感兴趣,而不是上升部分。请查看代码的结果图[plot]。

相关问题