选择完成后,机器人中的选取器列表重置为NULL(R)

时间:2012-05-16 13:07:03

标签: r

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

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,它结合了两个图并在操纵器内调用它,将“Factors”作为列表传递给picker选项。

0 个答案:

没有答案