title: R error: promise already under evaluation
body: <p>Can anyone explain how to fix this error? I realize I have not provided all the code. The data is from the well-known weather golf data. The error I am getting is <em>Error in probPCNB(varClass = "play", valueClass = i, inputVar1 = "windy",  : 
    promise already under evaluation: recursive default argument reference or earlier problems?</em> I have seen some answers to this kind of problem but I don't exactly understand them and especially in this case. Althougt there are other questions that address this error, it is not clear where the error comes from in this case.</p>
  
  <pre><code>golf=read.csv(file="weather.nominal.csv")
  df=as.data.frame(golf)
  df$names&lt;-rownames(df)
  
  
  conditional_prob_bool &lt;- function(spec11, spec12, spec21, spec22, df){ 
  
    consequent_bool &lt;- df[,spec11] == spec12
  
    consequent_event &lt;- df[consequent_bool,] 
  
    antecedent_bool &lt;- df[,spec21] == spec22
    antecedent_event=df[antecedent_bool,]
  
    return(prob(intersect_event(consequent_event,antecedent_event,df),df)/prob(antecedent_event,df))
  }
  
  
  
  predNBVar2=function(varClass='play',inputVar1='windy',var1Level='TRUE',inputVar2='humidity',var2Level="high",df=df){
    ##probPCNB(varClass='play', valueClass='yes', inputVar1='windy',var1Level='TRUE',inputVar2='humidity',var2Level="high",df)
    #browser()
    #lev2=levels(df[,varClass])
    lev2=c('yes','no')
    #lev2=levels(df$varClass)
    countt=0
    classprob=0
    predictedclass=lev2[1]
    for(i in lev2){
      p=probPCNB(varClass='play', valueClass=i, inputVar1='windy',var1Level='TRUE',inputVar2='humidity',var2Level="high",df=df)
      if(classprob&lt;p){
        classprob=p
        predictedclass=i
      }
  
  
    }
    return(paste("best",predictedclass," with measure",classprob ))
  
  }
  
  
  
  
  probPCNB=function(varClass='play', valueClass='true', inputVar1='windy',var1Level=TRUE,inputVar2='humidity',var2Level='high',df){
    #browser()
  
    A_bool=df[,inputVar1]==var1Level &amp; df[,inputVar2]==var2Level
    A=df[A_bool,]
  
    class_bool=df[,varClass]==valueClass
    classE=df[class_bool,]
  
  
    numerator=prob(classE,df)*conditional_prob_bool(inputVar1, var1Level,varClass,valueClass,df)*conditional_prob_bool(inputVar2, var2Level,varClass,valueClass,df)
  
  
    lev=levels(df[,varClass])
    denominator=0
  
    for(i in lev){
  
      class_bool=df[,varClass]==i
  
      classE=df[class_bool,]
      class=i
      denominator= denominator+(prob(classE,df)*conditional_prob_bool(inputVar1, var1Level,varClass,class,df)*
                                  conditional_prob_bool(inputVar2, var2Level,varClass,class,df))
  
    }
    return(numerator/denominator)
  
  }
  
  predNBVar2()
  </code></pre>