[R] Batch mode questions.
Rich Shepard
r@hep@rd @ending from @ppl-eco@y@@com
Wed Jul 25 23:54:20 CEST 2018
On Wed, 25 Jul 2018, Shawn Way wrote:
> To get you start, here's a script I used to combine any number of files
> into one data.frame.
>
> library(knitr)
> library(tidyverse)
> library(xlsx)
> library(xtable)
> library(lubridate)
>
> # create a list from these files
> list.filenames<-list.files(pattern=".CSV$") # This gets a list of all CSV files
>
> data <- list.filenames %>%
> map(read_csv) %>% # This reads all the files in order
> reduce(rbind) # This combines the data into one data frame
Thanks, Shawn. I'm reading up on functions and will look at using a
function within either a Rscript or source'd script.
It's about time I learn to automate repeated, tedious tasks in R.
Much appreciated,
Rich
More information about the R-help
mailing list