R cmd检查中的警告
在执行R cmd检查时,我收到以下警告: 正在检查S3泛型/方法一致性。。。警告 绘图: 函数(x,…) plot.logReg: 函数(对象、cv、变量名等) 请参阅“编写R扩展”手册中的“通用函数和方法”一节 我真的很难找到这个问题的根源。我将在下面发布我的代码 谢谢你的时间和帮助R cmd检查中的警告,r,R,在执行R cmd检查时,我收到以下警告: 正在检查S3泛型/方法一致性。。。警告 绘图: 函数(x,…) plot.logReg: 函数(对象、cv、变量名等) 请参阅“编写R扩展”手册中的“通用函数和方法”一节 我真的很难找到这个问题的根源。我将在下面发布我的代码 谢谢你的时间和帮助 plot.logReg <- function(object, cv, varName, ...) { keep_loop = TRUE while (keep_loop) { switch
plot.logReg <- function(object, cv, varName, ...) {
keep_loop = TRUE
while (keep_loop) {
switch (menu(c("QQ plot for residuals of logistic regression",
"Outlier Detection",
"Logistic regression model fit", "exit"),
title = "Which plot?"),
1 == {
qqnorm(object$residuals,
main = "Normal QQ-Plot of Model Residuals",
ylab = "Residuals")
# plot residuals against the theoretical quantils of
# the standard normal distribution and give the plot the titel
# "Normal QQ-Plot of Model Residuals"
qqline(object$residuals)
# add the line through the origin
},
2 == {
mydata2 <- cbind(object$data, c(1:length(object$y)))
#create a new column with the index values
colnames(mydata2)[ncol(mydata2)] <- "Index"
# name the new column Index
plot(mydata2$Index, object$pearsonStandard, xlab = "Index",
ylab = "standardized Pearson Residuals",
main = "Outlier Detection")
# plot the values of Index against the standardized Pearson
#residuals
abline(h = cv, lty = 2)
abline(h = -cv, lty = 2)
# creates two horizontal lines in dependence of the critical
# value cv
textxy(as.numeric(names(
object$pearsonStandard[which(object$pearsonStandard <- cv |
object$pearsonStandard > cv)])),
object$pearsonStandard[which(object$pearsonStandard <- cv |
object$pearsonStandard > cv)],
as.numeric(names(object$pearsonStandard[
which(object$pearsonStandard <- cv |
object$pearsonStandard > cv)])),
cex = 0.7,offset = -1)
# applies the index number to those values, that are ourtside of
# the interval [-cv; cv]
},
3 == {
mydata2 <- object$data[with(object$data,
order(object$data %>%
pull(varName))), ]
# creates a new data frame with ordered data
# only the desired variable is ordered from small to big values
# after ordering the observations are still the same but ordererd
# according to the variable varName
points <- (predict.logReg(logReg(object$y ~ varName, data =
mydata2)))
# claculates points of the predictions given the values of varName
plot(mydata2 %>% pull(varName), points[, 1],
xlab = "varName", ylab = "Probabilities")
# plotting varName against their predictions
lines(x = mydata2 %>% pull(varName), y = points[, 1])
# draws a line through the predictions
},
4 == {
keep_loop = FALSE
# stops the loop
})
}
}
plot.logReg