Skip to content

Instantly share code, notes, and snippets.

@opplatek
Created August 3, 2023 08:17
Show Gist options
  • Save opplatek/54a3388eee22b858635e97050ca646f2 to your computer and use it in GitHub Desktop.
Save opplatek/54a3388eee22b858635e97050ca646f2 to your computer and use it in GitHub Desktop.
Read a list of files (TSV) and merge them to one data.frame
#
# Read a list of files (TSV) and merge them to one data.frame
#
read_tsv <- function(x){
df.file <- read.table(file = x, header = T, stringsAsFactors = F, sep = "\t")
return(df.file)
}
files <- c("a.tsv", "b.tsv", "c.tsv")
df_list <- lapply(files, read_tsv)
df <- do.call(rbind, df_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment