I would love some help figuring out if the column names in 34 .txt files are identical. The columns should make up the first 69 values in the files. I'm very new to R, but have programmed before, so I would prefer a low-level solution that I can understand.
In addition, I haven't found a way to efficiently read in all of the files. This seems not to be necessary for the remainder of my code. But I can imagine it might be necessary for the above.
Finally, in the screenshot you will see that I have a list of all the .txt files (called all_files), I have one .txt file read in, and I created a list of the column names in that .txt files (called column_names).
The idea I came up with was the following:
I think the problem here is that:
colnames(all_files[i]) doesn't work because:
- the files are not read in
- all_files[i] returns a string with .txt at the end, but colnames() wants the file name without .txt
I hope this all makes some kind of sense. Thanks very much in advance.
Kind regards,
Boris Pinksterboer