1234567891011121314151617181920212223242526 |
- args <- commandArgs(trailingOnly = TRUE)
- if(length(args) < 1) {
- stop("Please provide at least one TSV file as input.")
- }
- first_file <- read.table(args[1], header = TRUE, sep="\t", stringsAsFactors = FALSE)
- stats_names <- first_file$Statistics
- results <- data.frame(Statistics = stats_names)
- for(file in args) {
- sample_data <- read.table(file, header = TRUE, sep="\t", stringsAsFactors = FALSE)
- sample_name <- colnames(sample_data)[2]
- results[sample_name] <- sample_data[,2]
- }
- write.table(results, sep="\t", quote=FALSE, row.names=FALSE, col.names=TRUE)
|