Skip to content

Commit

Permalink
Added combined xlsx version of raw data tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbgoodman committed Sep 7, 2022
1 parent 54af03d commit 59fada7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tables/convert_tables_to_xlsx.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
library(data.table)
library(openxlsx)
table_dir = '/Volumes/HFSE/Box/tcsl/tcsl-lenti/tables'

load_csvs <- function(filenames) {

table_list <- list()

descriptions <- data.table()

for (filename in filenames) {
file_id <- gsub('.*/(.*)\\.csv','\\1', filename)
table <- fread(filename)
header <- as.character(fread(filename, header=F, skip=0, nrows=1, sep = '|')[1,1])
header <- gsub('# ','',header)
descriptions <- rbind(descriptions, data.table('Workbook Name'= file_id, 'Description'=header))

table_list[[file_id]] <- table
}

table_list <- c(list('descriptions'=descriptions), table_list)

return(table_list)
}

table_list <- load_csvs(Sys.glob(paste0(table_dir,'/*.csv')))

write.xlsx(table_list, file = "supp_raw_data.xlsx")
Binary file added tables/supp_raw_data.xlsx
Binary file not shown.

0 comments on commit 59fada7

Please sign in to comment.