You can try this:
filelist = list.files(pattern = ".*.txt")
#assuming tab separated values with a header
datalist = lapply(filelist, function(x)read.table(x, header=T))
#assuming the same header/columns for all files
datafr = do.call("rbind", datalist)
More Related Contents:
- How to index an element of a list object in R
- Grouping functions (tapply, by, aggregate) and the *apply family
- Access lapply index names inside FUN
- Specify custom Date format for colClasses argument in read.table/read.csv
- Read multiple CSV files into separate data frames
- lapply vs for loop – Performance R
- Read all files in a folder and apply a function to each data frame
- How can you read a CSV file in R with different number of columns
- Faster way to read fixed-width files
- read.csv warning ‘EOF within quoted string’ prevents complete reading of file
- ‘Embedded nul in string’ error when importing csv with fread
- Same function over multiple data frames in R
- Returning anonymous functions from lapply – what is going wrong?
- How to avoid: read.table truncates numeric values beginning with 0
- Access and preserve list names in lapply function
- passing several arguments to FUN of lapply (and others *apply)
- lapply-ing with the “$” function
- What are the performance differences between for-loops and the apply family of functions?
- How to tell lapply to ignore an error and process the next thing in the list?
- Add “filename” column to table as multiple files are read and bound
- Issue when importing dataset: `Error in scan(…): line 1 did not have 145 elements`
- Writing multiple data frames into .csv files using R
- Using lapply to apply a function over list of data frames and saving output to files with different names
- Reason behind speed of fread in data.table package in R
- How can I read the header but also skip lines – read.table()?
- Creating a named list from two vectors (names, values)
- Union of intersecting vectors in a list in R
- Reading a CSV file organized horizontally
- Importing “csv” file with multiple-character separator to R?
- Numeric comparison difficulty in R