text: user285: I have set of modules from various condition  ,with first column as Probe_ID name and I have an annotation file with Probe_ID and Gene_name.
  I have to map the Probe_ID to gene name in each file and write it back.
  So what im doing is as such 
  filelist = list.files(pattern = ".*.txt")
  
  I get list of files 
  Then those list of files into list of dataframe
  datalist = lapply(filelist, function(x)read.table(x, header=T)) 
  
  Now i read into the annotation file 
  ANNOTATION_FILE <- read_delim("/run/media/punit/data1/Dev_bio_info/ANNOTATION_FILE.txt", 
      "\t", escape_double = FALSE, trim_ws = TRUE)
  
  The normal way i do is 
  I perform inner_join(ANNOTATION_FILE,my_file) for single file but as i have like 22 files in the module .I want to do it in loop and im not sure how to proceed further.
  My data frame example 
  This is how my module files looks like .
  dput(head(module_ivory[c(1:10)]))
  structure(list(Gene = c("1556672_a_at", "1557803_at", "1558080_s_at", 
  "1566465_at", "213089_at", "213229_at"), GSM1304905 = c(5.977158746759, 
  6.83852532860115, 5.93931007942615, 6.11926533584282, 9.92182534751875, 
  10.2576150019626), GSM1304906 = c(7.51622774902859, 7.71268478229187, 
  7.32360342148457, 6.8928342169826, 9.12807784837542, 10.6767090567628
  ), GSM1304907 = c(6.58069278884036, 7.86890363253932, 6.9901005950279, 
  6.08614452085924, 10.1220627669628, 10.9203125158285), GSM1304908 = c(6.60119000844375, 
  6.71735654004629, 7.43132441110608, 5.48084261893207, 9.81689665710992, 
  10.7649566455486), GSM1304909 = c(5.95049879217177, 6.132975671606, 
  7.0902951305213, 5.59408027736444, 9.08474568290096, 9.84784203563294
  ), GSM1304910 = c(5.83616005353191, 5.94947517647125, 6.61469427098759, 
  4.31285839654272, 9.44446310110043, 9.99021299504538), GSM1304911 = c(5.92373056182016, 
  6.14502105445603, 6.2333758614231, 5.46455403294761, 9.55447963883665, 
  10.1810888944642), GSM1304912 = c(6.43107367158601, 6.36340779490876, 
  7.18374247647159, 5.71508717609646, 9.61355221684561, 10.3266656836978
  ), GSM1304913 = c(6.4010171640209, 7.31600259413326, 6.16969520557938, 
  5.40234538288784, 8.89481478840621, 10.290064262843)), class = c("tbl_df", 
  "tbl", "data.frame"), row.names = c(NA, -6L))
  
  My annotation file 
  dput(head(ANNOTATION_FILE))
  structure(list(Gene = c("1007_s_at", "1053_at", "117_at", "121_at", 
  "1255_g_at", "1294_at"), Gene_Symbol = c("DDR1 /// MIR4640", 
  "RFC2", "HSPA6", "PAX8", "GUCA1A", "MIR5193 /// UBA7")), class = c("tbl_df", 
  "tbl", "data.frame"), row.names = c(NA, -6L))
  
  I would like to do inner join on each file and write them back into the file .
  Any help or suggestion would be really appreciated 
  
  user3541: To end up with a single table made by merging all your tables, you can give a try with reduce() of purrr:  The first argument .x would be the list of tables to merge (in your case the annotation file plus all the other files) and the .y argument would be your function, i.e. inner_join(). reduce() would merge all the tables within the given list, left to right or right to left. ... would enable you to specify column(s) to use as "anchors" while merging.
  If you would prefer to keep your tables separately then lapply() is the answer: lapply(list_of_files, function(x) inner_join(annotation_file, x)). This would give a list of merged tables.
  
original_text: 285: <p>I have set of modules from various condition  ,with first column as Probe_ID name and I have an annotation file with Probe_ID and Gene_name.</p>
  
  <p>I have to map the Probe_ID to gene name in each file and write it back.</p>
  
  <p>So what im doing is as such </p>
  
  <pre><code>filelist = list.files(pattern = ".*.txt")
  </code></pre>
  
  <p>I get list of files </p>
  
  <p>Then those list of files into list of dataframe</p>
  
  <pre><code>datalist = lapply(filelist, function(x)read.table(x, header=T)) 
  </code></pre>
  
  <p>Now i read into the annotation file </p>
  
  <pre><code>ANNOTATION_FILE &lt;- read_delim("/run/media/punit/data1/Dev_bio_info/ANNOTATION_FILE.txt", 
      "\t", escape_double = FALSE, trim_ws = TRUE)
  </code></pre>
  
  <p>The normal way i do is </p>
  
  <p>I perform inner_join(ANNOTATION_FILE,my_file) for single file but as i have like 22 files in the module .I want to do it in loop and im not sure how to proceed further.</p>
  
  <p>My data frame example </p>
  
  <p>This is how my module files looks like .</p>
  
  <pre><code>dput(head(module_ivory[c(1:10)]))
  structure(list(Gene = c("1556672_a_at", "1557803_at", "1558080_s_at", 
  "1566465_at", "213089_at", "213229_at"), GSM1304905 = c(5.977158746759, 
  6.83852532860115, 5.93931007942615, 6.11926533584282, 9.92182534751875, 
  10.2576150019626), GSM1304906 = c(7.51622774902859, 7.71268478229187, 
  7.32360342148457, 6.8928342169826, 9.12807784837542, 10.6767090567628
  ), GSM1304907 = c(6.58069278884036, 7.86890363253932, 6.9901005950279, 
  6.08614452085924, 10.1220627669628, 10.9203125158285), GSM1304908 = c(6.60119000844375, 
  6.71735654004629, 7.43132441110608, 5.48084261893207, 9.81689665710992, 
  10.7649566455486), GSM1304909 = c(5.95049879217177, 6.132975671606, 
  7.0902951305213, 5.59408027736444, 9.08474568290096, 9.84784203563294
  ), GSM1304910 = c(5.83616005353191, 5.94947517647125, 6.61469427098759, 
  4.31285839654272, 9.44446310110043, 9.99021299504538), GSM1304911 = c(5.92373056182016, 
  6.14502105445603, 6.2333758614231, 5.46455403294761, 9.55447963883665, 
  10.1810888944642), GSM1304912 = c(6.43107367158601, 6.36340779490876, 
  7.18374247647159, 5.71508717609646, 9.61355221684561, 10.3266656836978
  ), GSM1304913 = c(6.4010171640209, 7.31600259413326, 6.16969520557938, 
  5.40234538288784, 8.89481478840621, 10.290064262843)), class = c("tbl_df", 
  "tbl", "data.frame"), row.names = c(NA, -6L))
  </code></pre>
  
  <p>My annotation file </p>
  
  <pre><code>dput(head(ANNOTATION_FILE))
  structure(list(Gene = c("1007_s_at", "1053_at", "117_at", "121_at", 
  "1255_g_at", "1294_at"), Gene_Symbol = c("DDR1 /// MIR4640", 
  "RFC2", "HSPA6", "PAX8", "GUCA1A", "MIR5193 /// UBA7")), class = c("tbl_df", 
  "tbl", "data.frame"), row.names = c(NA, -6L))
  </code></pre>
  
  <p>I would like to do inner join on each file and write them back into the file .</p>
  
  <p>Any help or suggestion would be really appreciated </p>
   3541: <p>To end up with a single table made by merging all your tables, you can give a try with <code>reduce()</code> of <code>purrr</code>:  The first argument <code>.x</code> would be the list of tables to merge (in your case the annotation file plus all the other files) and the <code>.y</code> argument would be your function, i.e. <code>inner_join()</code>. <code>reduce()</code> would merge all the tables within the given list, left to right or right to left. <code>...</code> would enable you to specify column(s) to use as "anchors" while merging.</p>
  
  <p>If you would prefer to keep your tables separately then <code>lapply()</code> is the answer: <code>lapply(list_of_files, function(x) inner_join(annotation_file, x))</code>. This would give a list of merged tables.</p>
  