当我调用pie3D时,我得到错误“错误if(labelsep <minsep){:缺少值,其中需要TRUE / FALSE”并且代码退出 .
我怎样才能解决这个问题 . 没有if else声明 . 这似乎是pie3D的内部 .
pie3D(slices, labels=lbls,explode=0.2, main= atitle)
任何帮助将不胜感激
关心Ganesh
Update with code . 调用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时出错
Update :小数据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
1 回答
正如@NicE上面所建议的那样,确保标签和切片的长度相同 . 然后问题就消失了 .
关心Ganesh