df%>%
group_by(approved_date)%>%
summarise(rev=sum(gmv))%>%
ggplot(aes(x = approved_date, y = rev)) +
geom_line() +
geom_smooth(method = 'auto', se = FALSE) +
labs(x = 'Date', y = 'Revenue', title = 'Revenue by Date') +
scale_y_continuous(labels = function(x) format(x, scientific = FALSE)) +
stat_peaks(colour = "red", span = NULL) +
stat_valleys(colour = "blue", span = NULL) +
geom_text(aes(label = round(rev, 0)),
vjust = "inward",
hjust = "inward",
show.legend = FALSE,
check_overlap = TRUE)
我有这段代码,它在运行时标记了 Local Maxima 和 Minima 的所有值。我只想要全局最大值和全局最小值的值。如何做到这一点?