I have hundreds of .txt
files. I want to automate a process to read them all and save them with their respective file name. For example, I want to save them in this order without typing the name of individual files.
mytext1.txt <-read.table("./mytext1.txt", sep = "\t")
mytext2.txt <-read.table("./mytext2.txt", sep = "\t")
Here is the code I have tried which of course doesn't save the dataframe in a separate object name.
filelist = list.files(pattern = ".*.txt")
datalist = lapply(filelist, FUN=read.table, header=TRUE, sep = "\t")