小编hye*_*ryu的帖子

解析时间并转换为分钟

数据看起来像这样。

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)

如何将时间转换为分钟?

time r

6
推荐指数
1
解决办法
74
查看次数

我想画一个区域,但我不知道该怎么做

我的情节

我的意思是,我只想画出方形区域P1 X(Q1-Q2).

不是梯形(P2 + P1)X(Q1-Q2/2).

这是我用过的代码.我用过ggplotdplyr.我怎么解决这个问题?

我怎样才能画出唯一的方形区域而不是梯形区域!!!!

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)

plot r ggplot2

4
推荐指数
1
解决办法
83
查看次数

标签 统计

r ×2

ggplot2 ×1

plot ×1

time ×1