I have a directory of tab separated log files with varying dimensions and I am trying to load them into R.
Dir:
File1 (col1,col2,col3)
File2 (col3,col4,col5,col6,col7)
File3 (col1,col8,col9,col10)
To do this: I concatenated all the files in the directory to: all_files.tsv
When I tried to load them in R, as expected, it gave me an error message:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 436 did not have 12 elements
The code I am using is:
data <- read.table("all_vid_logs.tsv",
header=FALSE,
sep="\t" # use "\t" for tab-delimited files
)
So, my question is: 1. What is the best way to load all these files into a dataframe in R?
The output I am expecting is a single flat structure with all the columns.