0

我正在尝试使用操纵器函数生成图,其中选择器列表将从表中选择某些行(我将其作为列表传递给选择器)。当我运行操纵器时,它显示的情节非常适合第一次选择,但在我做出选择后,它给了我以下错误:-

Error in plot.window(...) : need finite 'xlim' values

In addition: Warning messages:

1: In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'
2: In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'    
3: In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'    
4: In min(x) : no non-missing arguments to min; returning Inf   
5: In max(x) : no non-missing arguments to max; returning -Inf 
6: In min(x) : no non-missing arguments to min; returning Inf   
7: In max(x) : no non-missing arguments to max; returning -Inf

以下是我的代码:-

Bivariate_Plots_cont=function(base_table,Table)
{
  c<- subset(base_table$segment_per_book, base_table$var_name==Table)
  print(c)
  plot(c, type="b", col="red", 
   axes=FALSE, xlab="Decile Starting Value", ylab="Event Rate (%)",main=Table,xaxt="n")

  axis(1, at=1:10,labels=subset(base_table$min,     base_table$var_name==Table),cex.axis=0.5)
  par(new=TRUE)

  plot(subset(base_table$per_distribution, base_table$var_name==Table), type="b",   col="blue", 
   axes=TRUE, xlab="", ylab="",xaxt="n")
}



Set_Factors_cont=function(base_table)
{
  Variables<<- unique(base_table$var_name)
  Factors <<- as.list(as.character(Variables))
}


Set_Factors_cont(cont3)


manipulate(
  Bivariate_Plots_cont(cont3,Table),
  Table=picker(Factors)
  )

基本上在上面的三段代码中,我定义了一个包装函数-Bivariate_Plots_cont,它结合了两个图,并在操纵器内部调用它,将“因子”作为列表传递给选择器选项。

4

0 回答 0