title: Nested " for loop" not working for opening and aggregating csv files
body: <p>Can anyone tell me why these nested for loop are not working </p>
  
  <pre><code>nom_fichiers &lt;- c("_Alias","_Autres_Codes","_Autres_Coord", "_Descriptif","_EntitesHydroBDLISA","_EntitesHydroBDRHFV1",
                   "_Evenements","_Fonctions","_MassesEau","_Proprietaires", "_Qual_Analyses","_Qual_Dossiers_Analyses",
                   "_Qual_Echantillons","_Qual_Operations","_Qual_Prelevements","_Qual_Sites_Mesures","_Stations_Hydro","_Usages")
  
  liste_nom_fichiers&lt;-as.list(as.character(nom_fichiers))
  
  # First for loop    
  for (i in seq.int(liste_nom_fichiers))
  {
  
      liste_fichier&lt;-list()
  
      filelist = list.files(path ="C:/Users/TB60063/Desktop/Export_ADES_POINTS_QUALITE",
                            pattern = paste0(liste_nom_fichiers[[i]], ".txt"), recursive = T)
  
  
      # Second for loop       
      for(i in seq.int(filelist)){
  
        # Opening files
  
        liste_fichier[[i]]&lt;- read.csv(filelist[i], header = T,sep = "|", dec =".")           
  
      }
  
      nom_output &lt;- assign(paste0("tbl", liste_nom_fichiers[[i]]), do.call("rbind", liste_fichier))
  
      # Enregistrement du fichier brut
  
      nom_fichier&lt;-paste0("tbl", liste_nom_fichiers, "_", "brut") 
      chemin &lt;- paste0("./data_brutes/", nom_fichier, ".csv")
      write.csv2(nom_output, chemin)
  
  
      return(nom_output)
  
  }
  </code></pre>
  
  <p>If i run the second manually (iteration by iteration it works) but if I run the whole script it's not working.</p>
  
  <p>I probably miss something.</p>