<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/day-13-little-helper-read_files/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.statworx.com/de/blog/day-13-little-helper-read_files/"> r-bloggers – STATWORX</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>We at <a rel="nofollow" href="https://www.statworx.com/" target="_blank">STATWORX</a> work a lot with R and we often use the same little helper functions within our projects. These functions ease our daily work life by reducing repetitive code parts or by creating overviews of our projects. At first, there was no plan to make a package, but soon I realised, that it will be much easier to share and improve those functions, if they are within a package. Up till the 24th December I will present one function each day from <a rel="nofollow" href="https://github.com/STATWORX/helfRlein" target="_blank"><code>helfRlein</code></a>. So, on the 13th day of Christmas my true love gave to me…</p>
<p><img alt="door-13-read-files" src="https://i2.wp.com/www.statworx.com/wp-content/uploads/door-13-read-files.png?w=450&ssl=1" class="wp-image-16308" data-recalc-dims="1"></p>
<h2>What can it do?</h2>
<p>This little helper reads in multiple files of the same type and combines them into a <code>data.table</code>. What kind of „file reading function“ should be used can be choosen by the <code>FUN</code> argument.</p>
<h2>How to use it?</h2>
<p>If you have a list of files, that all needs to be loaded in with the same function (e.g. <code>read.csv</code>), instead of using <code>lapply</code> and <code>rbindlist</code> now you can use this:</p>
<pre><code>read_files(files, FUN = readRDS)
read_files(files, FUN = readLines)
read_files(files, FUN = read.csv, sep = &quot;;&quot;)
</code></pre>
<p>Internally, it just uses <code>lapply</code> and <code>rbindlist</code> but you dont have to type it all the time. The <code>read_files</code> combines the single files by their column names and returns one data.table. Why data.table? Because I like it. But, let's not go down the rabbit hole of <em>data.table</em> vs <em>dplyr</em> (<a rel="nofollow" href="https://stackoverflow.com/questions/21435339/data-table-vs-dplyr-can-one-do-something-well-the-other-cant-or-does-poorly" target="_blank">to the rabbit hole …</a>).</p>
<h2>Overview</h2>
<p>To see all the other functions you can either check out our <a rel="nofollow" href="https://github.com/STATWORX/helfRlein" target="_blank">GitHub</a> or you can read about them <a rel="nofollow" href="https://www.statworx.com/tag/helfrlein/" target="_blank">here</a>.</p>
<p>Have a merry advent season!</p>
<div>
<h6>Über den Autor</h6>
<p><img src="https://i1.wp.com/www.statworx.com/wp-content/uploads/jakob-1-300x300.jpg?resize=180%2C180&ssl=1" width="180" alt="Jakob Gepp" class="wp-user-avatar wp-user-avatar-180" data-recalc-dims="1" height="180"></p>
<div>
<h4>Jakob Gepp</h4>
<p>Numbers were always my passion and as a data scientist and statistician at <a rel="nofollow" href="https://www.statworx.com/" target="_blank">STATWORX</a> I can fullfill my nerdy needs. Also I am responsable for our blog. So if you have any questions or suggestions, just send me an email!</p>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<h1>ABOUT US</h1>
</div>
</div>
</div>
<hr>
<div>
<p><span><span>STATWORX</span><br></span><span>is a consulting company for data science, statistics, machine learning and artificial intelligence </span><span>located in Frankfurt, Zurich and Vienna. Sign up for our NEWSLETTER and receive reads and treats from the world of data science and AI.</span> </p>
</div>
<p><a data-x-toggle="1" tabindex="0" data-x-toggleable="e15819-7">
<p> <span>
<p><span>
<p><i data-x-icon-o=""></i></p>
<p> <span><span>Sign Up Now!</span></span> </p></span>
<p>




<p>Der Beitrag <a rel="nofollow" href="https://www.statworx.com/de/blog/day-13-little-helper-read_files/" target="_blank">Day 13 – little helper read_files</a> erschien zuerst auf <a rel="nofollow" href="https://www.statworx.com/de/" target="_blank">STATWORX</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.statworx.com/de/blog/day-13-little-helper-read_files/"> r-bloggers – STATWORX</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/wl0VNsrYUIM" height="1"></a></div></span></a></div></div></div></div>