打开前如何检查文件大小? [英] How to check file size before opening?

查看:76
本文介绍了打开前如何检查文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将文件加载到R中之前,如何检查文件的大小?

How can I check the size of a file before I load it into R?

例如:

http://math.ucdenver.edu/RTutorial/titanic.txt

我想根据文件的大小使用最佳命令打开文件。

I'd like to use the optimal command to open a file based on the file's size.

推荐答案

使用 file.info()

file.info("data/ullyses.txt")

                    size isdir mode               mtime               ctime               atime  uid  gid
data/ullyses.txt 1573151 FALSE  664 2015-06-01 15:25:55 2015-06-01 15:25:55 2015-06-01 15:25:55 1008 1008

然后提取名为 size :

file.info("data/ullyses.txt")$size
[1] 1573151

这篇关于打开前如何检查文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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