title: "Could not find function" in Roxygen examples during CMD check
body: <p>I'm running a CMD check on a package in RStudio, part of which analyses the <code>@examples</code> in the inline Roxygen documentation.</p>
  
  <p>I'm getting this error:</p>
  
  <pre><code>checking examples ... ERROR
  Running examples in ‘packagename-Ex.R’ failed
  The error most likely occurred in:
  
  &gt; base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  &gt; ### Name: checkDate
  &gt; ### Title: Ensure that a date string is a valid date
  &gt; ### Aliases: checkDate
  &gt; 
  &gt; ### ** Examples
  &gt; 
  &gt; checkDate("2017-05-06")
  Error: could not find function "checkDate"
  </code></pre>
  
  <p>Within my .R file, the documentation is defined as:</p>
  
  <pre><code>#' Ensure that a date string is a valid date
  #'
  #' @param dateString A string (eg. "2017-12-04").
  #' @return TRUE or FALSE (and a warning if FALSE).
  #' @examples
  #' checkDate("2017-05-06")
  #' checkDate("2017-05-40")
  </code></pre>
  
  <p>I am using devtools 1.13.2 and roxygen2 6.0.1, both of which I believe to be up-to-date at time of posting.</p>
  
  <p>I have other packages using this same devtools/roxygen2 combination but have never before seen it fail to find a function name in <code>@examples</code> within its scope.</p>
  
  <p>Someone else seems to have experienced something similar as an update to <a href="https://stackoverflow.com/questions/23416902/examples-error-could-not-find-function-building-packages-in-r">this question</a>, but I can't see that anyone says how to fix it.</p>