title: Errors occur when I extract values from ncdf file in R
body: <p>I wrote a function to extract values from ncdf files, as shown below:</p>
  
  <pre><code>precresults &lt;- function(x){
      library(magrittr)
      library(ncdf4)
      library(raster)
      library(ncdf.tools)
      ##library(ncf)
      re1 &lt;- brick(nl1a[x])
      re &lt;- extract(re1,zuobiao)
          ####zuobiao stands for the coordinate of the targeted sites
      ###extract(zuobiao)
      return(re)
  }
  
  ###precresults(20)
  precresults11 &lt;- lapply(1:420, precresults)
  </code></pre>
  
  <p>"lapply" function is used to extract values for multiple site.</p>
  
  <p>However, an error occurs:</p>
  
  <blockquote>
    <p>Error in UseMethod("extract_") :    no applicable method for
    'extract_' applied to an object of class "c('RasterBrick', 'Raster',
    'RasterStackBrick', 'BasicRaster')"</p>
  </blockquote>
  
  <p>How can we solve such error?</p>