Transferring data from one file format to another is almost as fun as working on concordance tables for the different versions of the HS codes. That said, you can find several packages in R that allow for file conversions. The link below talks about the rio package and provides a very useful summary of its capabilities.
R-project rio package
In the event you have to convert a long list of files, perhaps the following link may be of help:
Convert several txt files to csv using R.