How do you read in multiple .txt files into R? -
I am using R which visualizes some data. There are a few hundred files in a directory and I want to load it in one table, in one shot.
Any help?
Edit:
Listing files is not a problem. But I'm having trouble going from the list to the content I have tried some code from, but I get a bug with this part:
all.the.data & lt; - lapply (all.the.files, txt, header = TRUE)
is saying: error in match.fun (FUN): object 'txt' not found < / Pre>
Any snippet of code that will explain this problem.
You can try:
filelist = list.files (pattern = ". * .txt") # header datalist = lapply (filelist, function (x) read.table (x, header = T) combines the values separated by tabs) # Exclude the same header / column for all the files, data = Do.call ("rbind", dentist )
Comments
Post a Comment