infiles <- dir(path=getwd(),pattern = "*_.tsv",recursive = T,full.names =T)
data.list <- lapply(infiles,read.delim(sep = '\t',header = T))
df <- data.table::rbindlist( data.list ,fill = TRUE) %>% replace_na(0) #按行合并多个数据框,不对称的数据填充为0
saveRDS(df,paste0(sampleName,"file.out.rds"))
网友评论