Need help with importing the text file with metadata and multiple data types into R.

I was trying to import the text files like the photo showed below into the R to tidy them up into CSV, but I found I couldn't read them into the R either by using read.table or readtext.

I have tried the readLines('CUP.text')[1], and it returns warning errors like 'line 1 appears to contain an embedded nulline 2 appears to contain an embedded nulline 3 appears to contain an embedded nulline ...' and the result was [1]"\xff\xfe-".

Could anyone help me with the direction of how could I deal with the text file?

Thank you!


The file you're trying to read does not adhere to any of the common data formats and seems to be a combination of unstructured text and tables.

Try using the scan function to read in files line by line as text, then perform all data cleaning needed.

scan(<pathtoFile>, character())

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.