I wanted to use fread function to load all the datasets as I think it would better to use one type of import function so I just sticked to the fread.
Few of my files are in xlsx format and I was saving them to csv format and then using the fread function was trying to load the datasets.
But I noticed that when I converted the xlsx files into csv, an empty or incomplete row was being created in the newly created csv files.
Is there a way I can resolve this issue? Can I load xlsx file somehow using the fread function rather than converting it to csv file and then loading it using the fread function?
The short answer is that you can't read xlsx files with fread , xlsx files have a very different format to the text files that fread is designed for.
We're able to successfully import the CSV file using the fread() function. Note: We used double backslashes (\\) in the file path to avoid a common import error. Notice that we didn't have to specify the delimiter either since the fread() function automatically detected that it was a comma.
Difference between read_xlsx() and read_excel() functions The result for reading the . xlsx file with the two functions is same. The only difference is that when read_excel() is used, excel_format() is called internally by the read_excel() function to determine if the path is xls or xlsx file from the file extension.
Here's how: Using command line tools directly in conjunction with csvkit like this
my.dt<-fread('in2csv my.xls')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With