title: Error - this S4 class is not subsettable
body: <p>I know there are several answers on this question, however I could not find any applicable to my question. Could anyone help me in regards to the error this S4 class is not subsettable at the bottom of this code. I am not sure where this error comes from. The output result should be the thresholded coefficients of DWT. </p>
  
  <pre><code>xx &lt;- list(list(c(1,2,3,4,5,6,7,5,4,3,2,4,3,2,3,5,4,3,2,3,4,5,6,3,4,3,3),
           c(0,3,1,4,1,2,7,5,4,1,3,4,9,2,7,5,1,3,2,2,1,1,1,5,1,3,1)),
        list(c(0,3,1,4,1,2,7,5,4,1,3,4,9,2,2,4,7,6,4,2,1,1,1,5,1,3,1),
           c(1,2,3,4,5,6,7,5,4,3,5,4,3,2,3,4,5,6,3,2,1,2,3,5,4,3,3)),
        list(c(0,3,1,4,1,2,7,5,4,1,3,4,3,2,2,4,7,6,4,2,1,1,1,5,1,3,1),
           c(1,2,3,4,5,6,4,3,2,3,5,4,3,2,3,4,5,6,3,2,1,2,3,5,4,3,3)))
  
  # Select Filter.  
  library(wavelets)
  filter &lt;- c    ("d2","d4","d6", "c6","d8","la8","la10","d12","c12","la12","la14","d14","d16","la16","d18","c18","la18") 
  boundary &lt;- c("periodic","reflection")
  g &lt;- seq(1:length(xx))
  fun &lt;- function (x) seq(1: as.integer (floor (logb ((length(xx[[x]][[1]])),base=2))))   
  nlevel &lt;- lapply( g,fun)
  fun &lt;-  function(x) expand.grid(filter=filter,nlevel=nlevel[[x]],boundary=boundary, stringsAsFactors=FALSE) 
  w3&lt;- lapply(g,fun)
  z &lt;- c(seq(1:length(w3)))                                                
  mapply3 &lt;- function(i) {
  w4 &lt;- w3[[i]]
  mapply ( function ( m,k,p,x ) modwt ( x, filter = m, n.levels = k, boundary=p) , w3[[i]]$filter, w3[[i]]$nlevel, w3[[i]]$boundary , MoreArgs = list(x = (xx[[i]][[1]])) )
  }
  DWT &lt;- lapply ( z, mapply3 )
  
  #---------------------------------------------------------------------------    
  vscale &lt;-  c("level")
  # smooth.levels  &lt;-  c(nlevel)
  prior &lt;- c("laplace")
  a  &lt;-  c(0.1,0.3) 
  bayesfac  &lt;-  c("TRUE")
  threshrule  &lt;-  c("median","mean")
  
  #---------------------------------------------------------------------------
  
  X &lt;-   seq(1:length(DWT))
  fun &lt;-   function (x) DWT[x]
  u  &lt;-   lapply(X,fun)
  fun &lt;-   function (x) seq(1:length(DWT[[x]]))
  U &lt;-   lapply(X,fun)
  L1   &lt;-   expand.grid (  vscale = vscale, prior = prior, a = a , bayesfac = bayesfac , threshrule = threshrule , stringsAsFactors = FALSE  )
  # --------------------------------------------------------------------------   
  library ( EbayesThresh )
  mapply2  &lt;- function ( DWTi , LL )                                                                                                  {
  mapply (  function ( c,e,f,g,h,x ) ebayesthresh.wavelet ( x, vscale = c, prior = e, a = f, bayesfac = g, threshrule = h ) , LL$vscale , LL$prior , LL$a , LL$bayesfac , LL$threshrule , MoreArgs  =   list  (  x   =   DWTi )  )
  } 
  mapply3 &lt;-  function(  i, L1, DWT  )  {  
  DWTi      &lt;-   DWT      [[i]][U[[i]]]         
  w3          &lt;-   L1 
  lapply( DWTi, mapply2, w3 )    
  } 
  M1 &lt;-   lapply(z, mapply3, L1, DWT) 
  # Error in x.dwt[[j]] : this S4 class is not subsettable
  </code></pre>