Import multiple text files in R and assign them names from a predetermined list

后端 未结 2 903
梦如初夏
梦如初夏 2020-12-05 12:24

I just started using R and I am having trouble performing the following task: I have approximately 130 language samples in separate plain text files sitting in my working di

2条回答
  •  盖世英雄少女心
    2020-12-05 12:59

                files <- list.files(pattern = 'Patient*.txt')    
                for(i in files) {
                x <- read.table(i, header=TRUE, comment.char = "A", sep="\t")
                assign(i,x)  
                }
    

提交回复
热议问题