Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用flow::flow_run()浏览函数时出错 问题_R - Fatal编程技术网

使用flow::flow_run()浏览函数时出错 问题

使用flow::flow_run()浏览函数时出错 问题,r,R,我尝试使用新的流包浏览函数,如下所示: 函数定义 错误: 我错过了什么 flow::flow\u run()遇到了很多问题,很抱歉 请重新安装该软件包,以下各项应能正常工作 库(TIBLE) #remotes::install_github(“moodymudskipper/flow”) 图书馆(流动) 流量运行(计算decc(初始DV=25, 初始间距=200, 静止时间间隔=10, t=1/60, nrows=1000, LV_acc_mps2=矢量(模式=“双”,长度=1000), den

我尝试使用新的
包浏览函数,如下所示:

函数定义 错误: 我错过了什么

flow::flow\u run()
遇到了很多问题,很抱歉

请重新安装该软件包,以下各项应能正常工作

库(TIBLE)
#remotes::install_github(“moodymudskipper/flow”)
图书馆(流动)
流量运行(计算decc(初始DV=25,
初始间距=200,
静止时间间隔=10,
t=1/60,
nrows=1000,
LV_acc_mps2=矢量(模式=“双”,长度=1000),
den=2),browse=TRUE)
它将触发函数体中的浏览器,除了您会注意到一些
flow::update()
调用之外,这些调用会悄悄地更新图表的数据

每当您想绘制当前情况的图表时,调用
d
,不带括号(如果
d
被变量覆盖,请使用
flow\u draw()
,以获得相同的效果)


这太好了。感谢您提供此套餐和您的持续改进。
library(tibble)
calculate_decc <- function(initial_DV, 
                                 initial_frspacing, 
                                 standstill_frspacing,
                                 t, 
                                 nrows,
                                 LV_acc_mps2,
                                 den){
  
  D_first <- ((initial_DV)^2) / (den * (standstill_frspacing - initial_frspacing)) + LV_acc_mps2[1]
  
  # D_reqd <- existing_decc + D_first
  
  
  
  DV <- vector(mode = "double", length = nrows)
  
  DV[1] <- initial_DV
  
  
  
  D <- vector(mode = "double", length = nrows)
  
  D[1] <- D_first
  
  
  
  Z <- vector(mode = "double", length = nrows)
  
  Z[1] <- initial_frspacing
  
  
  
  for (i in 2:nrows) {
    
    DV[i] <- DV[i-1] + ((D[i-1] - LV_acc_mps2[i-1]) * t)
    
    Z[i] <- Z[i-1] - ((DV[i-1] * t) + (0.5 * (D[i-1]-LV_acc_mps2[i-1]) * t^2))
    
    D[i] <- ((DV[i])^2) / (den * (standstill_frspacing - Z[i])) + LV_acc_mps2[i]
    
  }
  
  return(tibble(DV, Z, D))
  
}
flow_run(calculate_decc(initial_DV = 25, 
                         initial_frspacing =200, 
                         standstill_frspacing=10,
                         t=1/60, 
                         nrows=1000,
                         LV_acc_mps2=vector(mode = "double", length = 1000),
                         den=2),
          , browse = TRUE)  
> flow_run(calculate_decc(initial_DV = 25, 
+                          initial_frspacing =200, 
+                          standstill_frspacing=10,
+                          t=1/60, 
+                          nrows=1000,
+                          LV_acc_mps2=vector(mode = "double", length = 1000),
+                          den=2),
+           , browse = TRUE)
Next block:  standard 
 D_first <- ((initial_DV)^2)/(den * (standstill_frspacing - initial_frspacing)) + ;    LV_acc_mps2[1];DV <- vector(mode = "double", length = nrows);DV[1] <- initial_DV;D <- vector(mode = "double", length = nrows);D[1] <- D_first;Z <- vector(mode = "double", length = nrows);Z[1] <- initial_frspacing 
flow_browser[1]> 
Next block:  for 
 for (i in 2:nrows) 
flow_browser[2]> 
Error: object 'DV' not found  
> calculate_decc(initial_DV = 25, 
+                          initial_frspacing =200, 
+                          standstill_frspacing=10,
+                          t=1/60, 
+                          nrows=1000,
+                          LV_acc_mps2=vector(mode = "double", length = 1000),
+                          den=2)
# A tibble: 1,000 x 3
      DV     Z     D
   <dbl> <dbl> <dbl>
 1  25    200  -1.64
 2  25.0  200. -1.64
 3  24.9  199. -1.64
 4  24.9  199. -1.64
 5  24.9  198. -1.64
 6  24.9  198. -1.64
 7  24.8  198. -1.64
 8  24.8  197. -1.64
 9  24.8  197. -1.64
10  24.8  196. -1.64
# ... with 990 more rows