提问人:Espejito 提问时间:6/22/2023 更新时间:6/22/2023 访问量:28
R PROMETHEE 包:“列处的数据集不是数字:1”
R PROMETHEE package: "Data set not numeric at column: 1"
问:
我正在应用称为 PROMETHEE 的多准则决策分析方法。我遵循此处显示的示例:https://cran.rproject.org/web/packages/PROMETHEE/vignettes/PROMETHEE_vignette.pdf
我正在使用我自己的数据。使用代码进行评估后,出现此错误
Error in PROMETHEE(dataset, PreferenceF, PreferenceT, IndifferenceT, Weights, :
dataset: Data set not numeric at column: 1
此错误消息指的是哪一列,为什么?
#get the data
dataset <- structure(list(PV = c(4, 2, 1, 2), LC = c(1.5, 35, 7, 4.3), log_Kow = c(2.6,
1.4, 1.9, 2.5), BD = c(0.2, 0, 0.1, 0.5)), row.names = c(NA,
-4L), class = c("tbl_df", "tbl", "data.frame"))
#setting the preference functions
PreferenceF <- structure(list(PV = c("Gaussian", "Gaussian", "Gaussian", "Gaussian"
), LC = c("Linear", "Linear", "Linear", "Linear"), log_Kow = c("V-shape",
"V-shape", "V-shape", "V-shape"), BD = c("Level", "Level", "Level",
"Level")), class = "data.frame", row.names = c(NA, -4L))
#next, five steps of input
PreferenceT <- structure(list(PV = c(2L, 2L, 2L, 2L), LC = c(50000L, 50000L,
50000L, 50000L), log_Kow = c(2L, 2L, 2L, 2L), BD = c(5L, 5L,
5L, 5L)), class = "data.frame", row.names = c(NA, -4L))
IndifferenceT <- structure(list(PV = c(1L, 1L, 1L, 1L), LC = c(10000L, 10000L,
10000L, 10000L), log_Kow = c(0L, 0L, 0L, 0L), BD = c(2L, 2L,
2L, 2L)), class = "data.frame", row.names = c(NA, -4L))
Weights <- structure(list(PV = c(0.25, 0.25, 0.25, 0.25), LC = c(0.25, 0.25,
0.25, 0.25), log_Kow = c(0.25, 0.25, 0.25, 0.25), BD = c(0.25,
0.25, 0.25, 0.25)), class = "data.frame", row.names = c(NA, -4L
))
Min_Max <- structure(list(PV = c("min", "min", "min", "min"), LC = c("min",
"min", "min", "min"), log_Kow = c("max", "max", "max", "max"),
BD = c("min", "min", "min", "min")), class = "data.frame", row.names = c(NA,
-4L))
S_Gauss <- structure(list(PV = c(2L, 2L, 2L, 2L), LC = c(0L, 0L, 0L, 0L),
log_Kow = c(0L, 0L, 0L, 0L), BD = c(0L, 0L, 0L, 0L)), class = "data.frame", row.names = c(NA,
-4L))
#code for evaluation
PF=PROMETHEE(dataset,PreferenceF,PreferenceT,IndifferenceT,Weights,Min_Max,S_Gauss)
答: 暂无答案
评论
dataset
dataset <- as.data.frame(dataset)