当我调用pie3D时,我收到错误 " if(labelsep< minsep){:缺少值需要TRUE / FALSE" 并且代码退出。
我该如何解决这个问题。没有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&lt; 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
答案 0 :(得分:1)
正如@NicE上面所建议的那样,确保标签和切片的长度相同。然后问题就消失了。
此致 内甚