Skip to content

Instantly share code, notes, and snippets.

@timedreamer
Last active September 25, 2019 02:24
Show Gist options
  • Save timedreamer/272c5f62900b1c19ed625f173067ab88 to your computer and use it in GitHub Desktop.
Save timedreamer/272c5f62900b1c19ed625f173067ab88 to your computer and use it in GitHub Desktop.
Read all files in a folder(sub-folder) into a dataframe in R.
# Date: 2019-09-24
list_of_files <- list.files(path = here("data", "dap_download_may2016_genes"),
recursive = TRUE, pattern = "\\.txt$", full.names = TRUE)
# I discard the amp-DAP data.
list_of_files <- list_of_files[!str_detect(list_of_files, "amp")]
dap <- list_of_files %>%
set_names(.) %>%
map_df(read_tsv) %>%
rename(regulator = "tf.at_id", target = "target.at_id")
write_tsv(dap, here("data", "arabidopsis_dapseq_all_noamp.tsv.gz"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment