unable to open .dat files on R even with haven installed

317 Views Asked by At

So I use SGA tools for processing my images. It gives back results in .dat files. Now in order to work on this data in R, I tried to import the .dat file using the haven package. I installed haven and then its library, but I am not able to import data still and it gives this error message.

Error: Failed to parse C:/Users/QuRana/Desktop/SGA Tools/Plate_Image_Example (1).dat: This version of the file format is not supported.

When I use this command install.packages("haven"), haven is loaded, but then when I load library using library(haven) nothing appears on my console except for this

> library(haven)

Then when I use this code:

datatrial1 <- read_dta("C:/Users/QuRana/Desktop/SGA Tools/Plate_Image_Example (1).dat") 

It gives me the error mentioned above. When I try converting my .dat file to a .csv file and load my data, the imported data adds additional "t" values before the values in columns except for the first one like this:

Flags: S - Colony spill or edge interference                                          C - Low colony circularity
# row\tcol\tsize\tcircularity\tflags                                                                              
1\t1\t4355\t0.9053\t                                                                                              
1\t2\t4456\t0.8401\t                                                                                              
1\t3\t3439\t0.8219\t                                                                                              
1\t4\t3215\t0.8707\t

All the t's before the numeric values are not what I want. Another issue that I am facing is I cannot install the gitter package on my R version which is R 4.2.2.

1

There are 1 best solutions below

2
On

You can read your tab separated file like so `read.delim("file_path", header = TRUE, sep = "\t")