title: Conflicting S3 class-names in different R-packages
body: <p>I see that similar questions have been asked for other languages but I could not find an answer for R. </p>
  
  <p>I am writing an R-package with an S3 class called "Matrix" in it. An object of this class represents a matrix with some application-specific properties and generic methods for it. I need to work with the vector representation of such objects, for which I use the base-function "as.vector". The problem is that a class called "Matrix" is defined in another R-package, and there is a method as.vector.Matrix for that class that seems to be loaded at startup. This results in a wrong method dispatch when I am calling as.vector on objects of my class "Matrix". </p>
  
  <pre><code># using a prefix '#' for the class name in order to avoid a name conflict.
  m1 &lt;- structure(matrix(rnorm(4), 2, 2), class=c("#Matrix", "matrix"))
  as.vector(m1)
  [1] -0.2785165 -0.3832539  0.7353889 -0.6382483
  
  # using class "Matrix" generates an error:
  m2 &lt;- structure(matrix(rnorm(4), 2, 2), class=c("Matrix", "matrix"))
  as.vector(m2)
  Error: not-yet-implemented method for coerce(&lt;Matrix&gt;, &lt;character&gt;).
  -&gt;&gt;  Ask the package authors to implement the missing feature.
  </code></pre>
  
  <p>To me there are two problems with this error: 
  First, at the time of writing a package, there is no way to know which R-packages will be loaded together with it. This can cause sporadic errors with the package, due to similar name conflicts.
  Second, even if there was a way to know of any potential conflicts, changing the class names in my package for the sake of avoiding such conflicts seems quite of an overkill. </p>