繁体   English   中英

r 编程-逻辑回归 plot

[英]r programming - logistic regression plot

  mutate(prob = ifelse(outcome == "pos", 0","1"))%>%
>   ggplot(aes( plasma_glucose, prob)) +
+   geom_point(alpha = 1) +
+   geom_smooth(method = "glm", method.args = list(family = "binomial")) +
+   labs(
+     title = "Logistic Regression Model", 
+     x = "Plasma Glucose Concentration",
+     y = "Probability of being diabete-pos"
+   )

输出错误: mutate() column prob有问题。 prob = ifelse(outcome == "pos", 0, 1, ) x 未使用的参数 (alist())

我是 R 编程的新手,不知道如何纠正上面的代码? 我正在尝试 plot 逻辑回归结果。

这是关于您的第一个错误消息unused argument (alist())的答案,以防其他人通过谷歌搜索该错误消息到达这里:

  • 如果您尝试使用此 function 没有的参数调用 function,则会在 R 中出现unused argument错误:例如:
foo <- function(x) x

foo(x = 10, y = 10) # notice the y-argument
#> Error in foo(x = 10, y = 10): unused argument (y = 10)
  • 如果调用带有尾随逗号的 function,则会出现unused argument (alist())错误,因为 R 将其视为另一个完全空的参数。 例如:
foo(x = 10, ) # notice the comma
#> Error in foo(x = 10, ): unused argument (alist())

正如@Rfanatic 在评论中所说,删除多余的逗号,此错误消息就会消失。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM