title: create and document a package with R6 classes
body: <p>I am currently creating my first R package (:D) with R6 class thanks to RStudio, devtools and roxygen2. When my package contains only functions, I can build and load it without problem. But when I want to document R6 classes (with fields and methods like "Node" in this package <a href="https://cran.r-project.org/web/packages/data.tree/data.tree.pdf" rel="noreferrer">https://cran.r-project.org/web/packages/data.tree/data.tree.pdf</a>), RStudio don't want to build the package. I tried to find the trick on forums, but information about this issue is very scarce </p>
  
  <p>My procedure:</p>
  
  <ol>
  <li>Open Rstudio, create a new project, I choose "R package"</li>
  <li>I fill out the name of the package and I am selecting the source files on which my packages will be based (one function and 3 classes).</li>
  </ol>
  
  <p>-> At this point, the procedure is Ok as I obtain the correct structure with "man" with a description of my different classes, "R" with the different scripts of these classes. </p>
  
  <p>But when I try to build and reload the package (having loaded beforehand the R6 packages) there is an error :</p>
  
  <pre><code>==&gt; R CMD INSTALL --no-multiarch --with-keep.source esa
  
  * installing to library ‘/home/cha/R/x86_64-pc-linux-gnu-library/3.0’
  * installing *source* package ‘esa’ ...
  ** R
  ** preparing package for lazy loading
  Error in eval(expr, envir, enclos) :
    impossible de trouver la fonction "R6Class" (translation: impossible to find the function "R6Class")
  Error : unable to load R code in package ‘esa’
  ERROR: lazy loading failed for package ‘esa’
  * removing ‘/home/cha/R/x86_64-pc-linux-gnu-library/3.0/esa’
  * restoring previous ‘/home/cha/R/x86_64-pc-linux-gnu-library/3.0/esa’  
  
  Exited with status 1. 
  </code></pre>
  
  <p>I don't understand how to fix this error as Rstudio is right: R6Class is not a function !</p>
  
  <p>My questions:</p>
  
  <p>Is my procedure correct ? How can I fix this error ? </p>
  
  <p>I need to know whether Rstudio is able to take in account R6 classes in R package building ? 
  If not, I can do it manually, but I just need to know in order to stop waisting my time trying with RStudio :)</p>
  
  <p>Thank you in advance for your help !!</p>
  
  <p>Cha</p>