title: World map overlay on level plot
body: <p>I am trying to place a world map on my current plots made by level plot. This plot was made as follows:  </p>
  
  <pre><code>library(raster)
  library(ncdf4)
  library(maps)
  library(maptools)
  library(rasterVis)
  library(ggplot2)
  library(rgdal)
  library(sp)
  library(gridExtra)
  
  MFplot4&lt;-levelplot(MFMeaner3,margin=F, at=Fcutpoints4,cuts=11, 
  pretty=TRUE,par.settings=mapTheme, main="Historical five-day maximum   
  precipitation (mm/day) model mean")
  </code></pre>
  
  <p>The object "MFMeaner3" has the following attributes:</p>
  
  <pre><code>class       : RasterLayer 
  dimensions  : 64, 128, 8192  (nrow, ncol, ncell)
  resolution  : 2.8125, 2.789327  (x, y)
  extent      : -181.4062, 178.5938, -89.25846, 89.25846  (xmin, xmax, ymin, 
  ymax)
  coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
  data source : in memory
  names       : layer 
  values      : 0.1583802, 164.2064  (min, max)
  </code></pre>
  
  <p>Here was my attempt to place a world map overlay on the above plot:</p>
  
  <pre><code>world.outlines&lt;-map("world", plot=FALSE) 
  world.outlines.sp&lt;-map2SpatialLines(world.outlines,proj4string =   
  CRS("+proj=longlat"))
  MFplot4 + layer(sp.lines(world.outlines.sp,col="black",lwd=0.5))
  </code></pre>
  
  <p>However, this leads to the following error:</p>
  
  <pre><code>Error: Attempted to create layer with no stat.
  </code></pre>
  
  <p>I also tried placing a simple world map using this:</p>
  
  <pre><code>MFplot4 + plot(wrld_simpl)
  </code></pre>
  
  <p>But I receive this error:</p>
  
  <pre><code>Error in UseMethod("as.layer") : 
  no applicable method for 'as.layer' applied to an object of class "NULL"
  </code></pre>
  
  <p>Why would these errors occur? </p>
  
  <p>Any assistance with this would be extremely appreciated!</p>