如何使用fread函数加载xlsx文件? [英] How to load xlsx file using fread function?

查看:201
本文介绍了如何使用fread函数加载xlsx文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用fread函数加载所有数据集,因为我认为最好使用一种类型的import函数,因此我坚持使用fread.

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.

我的文件很少是xlsx格式,我将它们保存为csv格式,然后使用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.

但是我注意到,当我将xlsx文件转换为csv时,新创建的csv文件中正在创建一个空的或不完整的行.

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.

有没有一种方法可以解决此问题?我可以使用fread函数以某种方式加载xlsx文件,而不是将其转换为csv文件,然后使用fread函数加载吗?

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?

推荐答案

操作方法如下:直接使用命令行工具 csvkit 像这样

Here's how: Using command line tools directly in conjunction with csvkit like this

my.dt<-fread('in2csv my.xls')

这篇关于如何使用fread函数加载xlsx文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆