Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
从R中的函数获取错误输出_R_Function_Dataframe_Combinations - Fatal编程技术网

从R中的函数获取错误输出

从R中的函数获取错误输出,r,function,dataframe,combinations,R,Function,Dataframe,Combinations,我有以下功能: Proposed <- function(N_b,Lanes,m,A,x.sqr,e_1,e_2,e_3,e_4,e_5,S,a,b) { e <- data.frame(e_1,e_2,e_3,e_4,e_5) CSi <- m * ((Lanes/N_b) + (A * (combn(e,Lanes,sum)) / x.sqr) * (b*S^a)) return(max(CSi)) } 与: 由于A为负值,因此当combn(e,Lanes,s

我有以下功能:

Proposed <- function(N_b,Lanes,m,A,x.sqr,e_1,e_2,e_3,e_4,e_5,S,a,b) {
  e <- data.frame(e_1,e_2,e_3,e_4,e_5)
  CSi <- m * ((Lanes/N_b) + (A * (combn(e,Lanes,sum)) / x.sqr) * (b*S^a))
  return(max(CSi))
}
与:


由于
A
为负值,因此当
combn(e,Lanes,sum)
最小化时,函数将最大化

x <- readr::read_table2("
 Lanes N_b N_l   A x.sqr  e_1 e_2  e_3   e_4 e_5  S Proposed.Girder1  UG       CSi    m
3   5   4 -12  1440 21.8 9.8 -2.2 -14.2   0 12        0.6261667 100 0.5918969 0.85
")

Proposed3 <- function(N_b,Lanes,m,A,x.sqr,e_1,e_2,e_3,e_4,e_5,S,a,b) {
  e <- data.frame(e_1,e_2,e_3,e_4,e_5)
  # Note "min"
  CSi <- m * ((Lanes/N_b) + (A * min(combn(e,Lanes,sum)) / x.sqr) * (b*S^a))
  return(CSi)
}

Proposed3(x[["N_b"]], x[["Lanes"]], x[["m"]], x[["A"]], x[["x.sqr"]], x[["e_1"]], x[["e_2"]], 
        x[["e_3"]], x[["e_4"]], x[["e_5"]],x[["S"]], a = 0.01, b = 0.5)
#> [1] 0.5695447
x
x <- DATA[1, ]
Proposed1(x[["N_b"]], x[["Lanes"]], x[["m"]], x[["A"]], x[["x.sqr"]], x[["e_1"]], x[["e_2"]], 
        x[["e_3"]], x[["e_4"]], x[["e_5"]],x[["S"]], a = 0.01, b = 0.5)

# [1] 0.5695447
Proposed2 <- function(N_b,Lanes,m,A,x.sqr,e_1,e_2,e_3,e_4,e_5,S,a,b) {
  e <- data.frame(e_1,e_2,e_3,e_4,e_5)
  CSi <- m * ((Lanes/N_b) + (A * max(combn(e,Lanes,sum)) / x.sqr) * (b*S^a))
  return(CSi)
}
Proposed2(x[["N_b"]], x[["Lanes"]], x[["m"]], x[["A"]], x[["x.sqr"]], x[["e_1"]], x[["e_2"]], 
        x[["e_3"]], x[["e_4"]], x[["e_5"]],x[["S"]], a = 0.01, b = 0.5)

# [1] 0.3952675
x <- readr::read_table2("
 Lanes N_b N_l   A x.sqr  e_1 e_2  e_3   e_4 e_5  S Proposed.Girder1  UG       CSi    m
3   5   4 -12  1440 21.8 9.8 -2.2 -14.2   0 12        0.6261667 100 0.5918969 0.85
")

Proposed3 <- function(N_b,Lanes,m,A,x.sqr,e_1,e_2,e_3,e_4,e_5,S,a,b) {
  e <- data.frame(e_1,e_2,e_3,e_4,e_5)
  # Note "min"
  CSi <- m * ((Lanes/N_b) + (A * min(combn(e,Lanes,sum)) / x.sqr) * (b*S^a))
  return(CSi)
}

Proposed3(x[["N_b"]], x[["Lanes"]], x[["m"]], x[["A"]], x[["x.sqr"]], x[["e_1"]], x[["e_2"]], 
        x[["e_3"]], x[["e_4"]], x[["e_5"]],x[["S"]], a = 0.01, b = 0.5)
#> [1] 0.5695447