数据看起来像这样。
data$arrival_time: int 1245 1345 1805 1950 710 755 2115 2215 615 730 ...
data$real_time : int 1256 1423 1859 2105 712 1009 2139 2344 542 946 ...
Run Code Online (Sandbox Code Playgroud)
例如,1245 表示 12:45,1345 表示 13:45。
而我只想将 12:45 转换为 765,将 13:45 转换为 825,因此可以将其转换format(hour:minutes)为分钟。(参见 12 60+450=765 和 13 60+45=825)
如何将时间转换为分钟?

我的意思是,我只想画出方形区域P1 X(Q1-Q2).
不是梯形(P2 + P1)X(Q1-Q2/2).
这是我用过的代码.我用过ggplot和dplyr.我怎么解决这个问题?
我怎样才能画出唯一的方形区域而不是梯形区域!!!!
library(ggplot2)
library(dplyr)
supply <- Hmisc::bezier(x = c(1, 8, 9),
y = c(1, 5, 9)) %>%
as_data_frame()
demand <- Hmisc::bezier(c(1, 3, 9),
c(9, 3, 1)) %>%
as_data_frame()
fun_supply <- approxfun(supply$x, supply$y, rule = 2)
fun_supply(c(2, 6, 8))
fun_demand <- approxfun(demand$x, demand$y, rule = 2)
intersection_funs <- uniroot(function(x) fun_supply(x) - fun_demand(x), c(1, 9))
intersection_funs
y_root <- fun_demand(intersection_funs$root)
curve_intersect <- function(curve1, curve2) {
# Approximate the functional form of both curves
curve1_f …Run Code Online (Sandbox Code Playgroud)