plotrix:pie3d:if (labelsep < minsep) { 错误:需要 TRUE/FALSE 的地方缺少值
plotrix:pie3d: Error in if (labelsep < minsep) { : missing value where TRUE/FALSE needed
当我调用 pie3D 时出现错误
"Error in if (labelsep < minsep) { : missing value where TRUE/FALSE needed "
代码退出。
我该如何解决这个问题。没有 if else 语句。这似乎是 pie3D 内部的。
pie3D(slices, labels=lbls,explode=0.2, main= atitle)
任何帮助将不胜感激
问候
象头神
更新代码。错误调用pie3D时代码存在。该错误没有帮助,似乎是指 pie3D 的内部变量。该代码适用于除 1.
以外的几种情况
d <- batsman$Dismissal
e <- d[ d != "-"]
lbls <- c("bowled","caught","hit wicket","lbw","not out", "retired not out",
"run out")
slices <- as.vector(table(e))
slices <- slices[slices != 0]
pct <- round(slices/sum(slices)*100)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
atitle <- paste("Pie chart of dismissals for ", name)
labelsep<-0
minsep <- 1
pie3D(slices, labels=lbls,explode=0.2, main= atitle)
此处出错
错误在
if (labelsep < minsep) { : 缺失值 TRUE/FALSE 需要
更新: 小数据
d
[1] bowled lbw run out bowled lbw caught caught caught
caught caught bowled caught caught
[14] not out caught lbw bowled caught caught caught not out lbw
lbw caught caught caught
按照上面@NicE 的建议,确保标签和切片的长度相同。然后问题就消失了。
问候
象头神
当我调用 pie3D 时出现错误 "Error in if (labelsep < minsep) { : missing value where TRUE/FALSE needed " 代码退出。
我该如何解决这个问题。没有 if else 语句。这似乎是 pie3D 内部的。
pie3D(slices, labels=lbls,explode=0.2, main= atitle)
任何帮助将不胜感激
问候 象头神
更新代码。错误调用pie3D时代码存在。该错误没有帮助,似乎是指 pie3D 的内部变量。该代码适用于除 1.
以外的几种情况d <- batsman$Dismissal
e <- d[ d != "-"]
lbls <- c("bowled","caught","hit wicket","lbw","not out", "retired not out",
"run out")
slices <- as.vector(table(e))
slices <- slices[slices != 0]
pct <- round(slices/sum(slices)*100)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
atitle <- paste("Pie chart of dismissals for ", name)
labelsep<-0
minsep <- 1
pie3D(slices, labels=lbls,explode=0.2, main= atitle)
此处出错 错误在 if (labelsep < minsep) { : 缺失值 TRUE/FALSE 需要
更新: 小数据 d
[1] bowled lbw run out bowled lbw caught caught caught
caught caught bowled caught caught
[14] not out caught lbw bowled caught caught caught not out lbw
lbw caught caught caught
按照上面@NicE 的建议,确保标签和切片的长度相同。然后问题就消失了。
问候 象头神