title: Override setClass and setMethod in a package R 3.0.1
body: <p>I am having problem to override setClass  and setMethod in a package</p>
  
  <p>Requirement: R 3.0.1, Rtools</p>
  
  <p>Please find below the steps to recreate the problem:</p>
  
  <h1>1. Create class and method</h1>
  
  <pre><code>setClass(Class="AAA",
             representation(
             name="character",
             val="numeric"
           )
  )
  
  setMethod("*", 
        signature(e1 = "numeric", e2 = "AAA"), 
        definition=function (e1, e2) {
            e2@val = e2@val * e1
        e2       
      }
  )
  </code></pre>
  
  <h1>2/ save the file in</h1>
  
  <blockquote>
    <p>C:\AAA.r</p>
  </blockquote>
  
  <h1>3/  build a package</h1>
  
  <pre><code>&gt;  setwd("C:")
  &gt;  package.skeleton(name="AAA",code_files="C:\\AAA.r")
  &gt;  system("R CMD build AAA")
  &gt;  system("R CMD INSTALL --build AAA")
  </code></pre>
  
  <h1>4/ testing</h1>
  
  <pre><code>&gt; library(AAA)
  &gt; x = new("AAA")
  &gt; x@val = 100
  &gt; -1 * x
  An object of class "AAA"
  Slot "name":
  character(0)
  
  Slot "val":
  [1] -100
  
  Slot "type":
  character(0)
  </code></pre>
  
  <h1>5/ override class and  method</h1>
  
  <pre><code>setClass(Class="AAA",
             representation(
             name="character",
             val="numeric",
             type="character",
             desc="character"
           )
  )
  
  setMethod("*", 
       signature(e1 = "numeric", e2 = "AAA"), 
                    definition=function (e1, e2) {
                      if (e2@type == "double"){
                          e2@val = e2@val * (2 * e1)       
                      } else {
                          e2@val = e2@val * e1 
                      }
                                   e2
                    }
          )
  </code></pre>
  
  <h1>6/ testing</h1>
  
  <pre><code>&gt; y = new("AAA")
  &gt; y@val=25
  &gt; y@type="double"
  &gt; -1 * y
  Error in -1 * y : invalid object (non-function) used as method
  </code></pre>
  
  <p>Please advise </p>