title: Error: $ operator not defined for this S4 class
body: <p>I'm trying to make a formula and I got the error:</p>
  
  <blockquote>
    <p>$ operator not defined for this S4 class with R.</p>
  </blockquote>
  
  <p>First of all, what is a S4 class? What am I doing wrong?</p>
  
  <p>Following the code:</p>
  
  <pre><code>as.formula("ctree(d$sex ~ d$ahe , data = d)")
  </code></pre>
  
  <p>If you want to reproduce it, the dataset (CSV file) <code>d</code> is <a href="https://github.com/vincentarelbundock/Rdatasets/blob/master/csv/Ecdat/CPSch3.csv" rel="noreferrer">available here</a>.</p>