0

When I try to read a data set into R with the following, I get the resulting error.

metabolites=read.table("Pacuta_Met_Pathway_Interest.csv",h=T,check.names=F, sep=',')

Warning message: In read.table("Pacuta_Met_Pathway_Interest.csv", h = T, check.names = F, : incomplete final line found by readTableHeader on 'Pacuta_Met_Pathway_Interest.csv'

In trying to fix it, I used the following, but received another error that I cannot understand. I am only reading in 1 file. Can someone please explain the problem? Below is a picture of how my data matrix looks. Pacuta_Met_Pathway_Interest.csv

metabolites=read.table(readLines("Pacuta_Met_Pathway_Interest.csv", warn = FALSE),h=T, sep=',')

Error in file(file, "rt") : invalid 'description' argument

Vinícius Félix
  • 4,501
  • 3
  • 12
  • 28
AWillz
  • 1
  • 1
  • Try using either `read.csv` or `data.table::fread`. It might also be fixed by adding `encoding = 'utf-8'` to `read.table` – Mako212 Oct 05 '21 at 20:18
  • Does this answer your question? ['Incomplete final line' warning when trying to read a .csv file into R](https://stackoverflow.com/questions/5990654/incomplete-final-line-warning-when-trying-to-read-a-csv-file-into-r) – Roman Nov 18 '21 at 04:02

1 Answers1

0

This is probably because your file lacks a "new line" character at the end of the final line. A possible fix is to open the file with a text editor and press Enter at the end of the last line.

I don't have your file so it's not possible to test it on my own, but have you tried using read.csv() instead?

anhtr
  • 51
  • 5