Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
plotrix:pie3d:if(labelsep<;minsep){:缺少需要TRUE/FALSE的值时出错_R_Plotrix - Fatal编程技术网

plotrix:pie3d:if(labelsep<;minsep){:缺少需要TRUE/FALSE的值时出错

plotrix:pie3d:if(labelsep<;minsep){:缺少需要TRUE/FALSE的值时出错,r,plotrix,R,Plotrix,当我打电话给pie3D时,我得到了错误信息 “if(labelsep

当我打电话给pie3D时,我得到了错误信息 “if(labelsep 如何修复此问题。没有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)

正如上面@NicE所建议的,确保标签和切片的长度相同。然后问题就消失了

问候
Ganesh

向我们展示您正在使用的对象。您是否尝试在
pie3D
的帮助文件中绘制示例?您是否将其输入与您的进行了比较,并试图找出两个数据集之间的差异?@RomanLuštrik-我添加了pie3D的代码。错误没有帮助。我们无法访问您的数据,因此很难判断发生了什么。您可以自己检查示例和数据之间的差异,也可以给我们一个例子。@RomanLuštrik数据看起来有329个值。其中包括一小部分。问题是pie3D在5种情况下工作,在其中1种情况下产生问题。这就是调试困难的原因。此外,变量是内部变量。不知道如何进行调试。想法-GaneshI认为问题发生在标签多于切片时,因此您可以
lbls
to
lbls
  [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