title: incorrect number of dimensions and incorrect number of subscripts in array
body: <p>I am new to using R and thus my question might be a simple one, but nonetheless I have spent a lot of time trying to figure out what I am doing wrong and to no avail. I have discovered a lot of help on this site in the past week searching through other questions/answers (thank you!) but as someone new, it is often difficult to interpret other people's code. </p>
  
  <p>I am trying to build a 3-dimensional array of multiple data files, each one with the same dimensions 57x57.</p>
  
  <pre><code># read in 100 files
  Files = lapply(Sys.glob('File*.txt'), read.table, sep='\t', as.is=TRUE)
  
  # convert to dataframes
  Files = lapply(Files[1:100], as.data.frame)
  
  # check dimensions of first file (it's the same for all)
  dim(Files[[1]])
  [1] 57 57
  
  # build empty array
  Array = array(dim=c(57,57,100))
  
  # read in the first data frame
  Array[,,1] = Files[1]
  
  # read in the second data frame
  Array[,,2] = Files[2]
  Error in Array[, , 2] = Files[2] : incorrect number of subscripts
  
  # if I check...
  Array[,,1] = Files[1]
  Error in Array[, , 1] : incorrect number of dimensions
  
  # The same thing happens when I do it in a loop:
  x = 0
  for(i in 1:100){
      Array[,,x+1] = Files[[i]]
      x = x + 1
  }
  
  Error in Array[, , 1] = Files[[1]] : 
    incorrect number of subscripts
  </code></pre>