Loading [MathJax]/jax/input/TeX/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >fread EOF而不是分隔符

fread EOF而不是分隔符
EN

Stack Overflow用户
提问于 2016-02-20 02:27:05
回答 2查看 3.2K关注 0票数 1

我试图用fread读取一个大文件,但我猜文件的布局有问题。

如果我尝试用以下命令读取文件

代码语言:javascript
运行
AI代码解释
复制
data = fread(input = "../data.txt", sep = "\t")

在这个文件中(我只取了包含错误的那一行,以及之前和之后的几行):

代码语言:javascript
运行
AI代码解释
复制
ID  imdbID  Title   Year    Rating  Runtime Genre   Released    Director    Writer  Cast    Metacritic  imdbRating  imdbVotes   Poster  Plot    FullPlot    Language    Country Awards  lastUpdated Type
683 tt0000683   The Fatal Hour  1908        14 min  Short, Crime    1908-08-18  D.W. Griffith   D.W. Griffith   George Gebhardt, Harry Solter, Linda Arvidson, Florence Auer        5.9 26      Pong Lee, a Mephistophelian, saffron-skinned varlet, has for some time carried on this atrocious female white slave traffic, in which sinister business he was assisted by a stygian whelp, ... Pong Lee, a Mephistophelian, saffron-skinned varlet, has for some time carried on this atrocious female white slave traffic, in which sinister business he was assisted by a stygian whelp, by name Hendricks. Pong writes Hendricks that he has need for five young girls, and so Hendricks sets out to secure them. Visiting a rural district, he has no trouble, by his glib, affable manner, in gaining the confidence of several young and pretty girls. Pong is on hand with a closed carriage to bag the prey. One of the girls, as she is seized, emits a yell that alarms the neighborhood and brings to the scene several policemen and a couple of detectives, who have long been on the lookout for these caitiffs. The Chinese get away with the carriage, however, and Hendricks by subterfuge throws the police on the wrong scent. One of the detectives is a woman, and possessed of shrewd powers of deduction, hence does not swallow the bald story of the villain, and exercises her natural acumen with success. She shadows Hendricks, and by means of a flirtation inveigles him to a restaurant, where she succeeds in doping his drink. He falls asleep and she secures the letter written by Pong, which discloses the hiding place of the Chinaman. This she immediately telephones to the police, and while so doing Hendricks awakes and starts off to warn his friends. He arrives at the old deserted house ahead of the police, but escape is impossible, so the police rescue the girls, but fail to secure Pong and Hendricks, who afterwards seize the girl detective, and taking her to the house, tie her to a post and arrange a large pistol on the face of a clock in such a way that when the hands point to twelve the gun is fired and the girl will receive the charge. Twenty minutes are allowed for them to get away, for the hands are now indicating 11:40. Certain death seems to be her fate, and would have been had not an accident disclosed her plight. Hendricks after leaving the place is thrown by a street car, and this serves to discover his identity, so he is captured and a wild ride is made to the house in which the poor girl is incarcerated. This incident is shown in alternate scenes. There is the helpless girl, with the clock ticking its way towards her destruction, and out on the road is the carriage, tearing along at breakneck speed to the rescue, arriving just in time to get her safely out of range of the pistol as it goes off. In conclusion we can promise this to be an exceedingly thrilling film, of more than ordinary interest.    English USA     2015-10-24 01:44:09.623000000   movie
684 tt0000684   Father Gets in the Game 1908        10 min  Short, Comedy   1908-10-10  D.W. Griffith   D.W. Griffith   Mack Sennett, Harry Solter, George Gebhardt, Linda Arvidson     5.1 39      "You have got to keep up with the bandwagon or quit." This never impressed old Wilkins so forcibly as when his son and daughter give him the go-by, stamping him as a "has-been," and away ...  "You have got to keep up with the bandwagon or quit." This never impressed old Wilkins so forcibly as when his son and daughter give him the go-by, stamping him as a "has-been," and away out of the game. Even Mrs. Wilkins, who is as vivacious as a widow, snubs him. He keenly feels his condition and resolves to alter it. With this in view, he enlists the services of Professor Dyem, the celebrated Dermatologist and Tonsorial Artist. After a session with the Professor, beheld the transmogrified Wilkins. What a change! Shorn of his grizzly beard, his locks raven, complexion florid, eye clear and step elastic, he views himself in the mirror. He hardly recognizes himself. In fact, it requires his valet to convince him that he is he. "Am I in it? Well. I guess. If I don't keep up with and even beat that bandwagon by a city block, my name is not Pill Wilkins." He sallies forth and makes for the park. The first person he encounters is his wife. He approaches her in elation, but she mistakes him for an impudent masher and he receives the weight of her parasol over his head for his trouble. The next one he meets is his daughter. She is seated on a bench, waiting for Charley. He takes a seat beside her and when he tries to make himself known she draws herself up to full height and with a blow sends him backward over the bench onto the grass. Well, he changes his tactics, and gets reckless. Along comes his son with his best girl, so he decides to win her out for spite. Now this young lady has a sensitive pneumogastric nerve, and when he sits beside her on the bench and slyly suggests a cold bottle and a hot bird, she is "his'n." This is done so coolly and so quickly, that young Wilkins, who, of course, does not recognize his respected papa, is speechless with rage. He follows them, however, to the café, where his intrusion is resented and he is rudely thrown from the place. At the Wilkins' domicile there is an indignation meeting. Mother, daughter and son all rush in to relate their experiences to father. He is not to be found. Suddenly a hilarious individual enters. "'Tis he, the insulter: a drunk and disorderly." They are about to have him thrown out when the valet comes to his rescue and explains that the jubilant gentleman is no other than their dear papa, who has not only caught up with the bandwagon, but is sitting on the seat with the driver. They all gasp in surprise, and young Wilkins takes a wreath of laurel from a statue and places it on old Wilkins' brow, saying: "Pop, you are the candy."    English USA     2015-10-02 04:59:48.643000000   movie
685 tt0000685   The Feud and the Turkey 1908        15 min  Short, Drama, Romance   1908-12-08  D.W. Griffith   D.W. Griffith   Harry Solter, Linda Arvidson, Arthur V. Johnson, Robert Harron      5.8 13      The Wilkinsons and Caulfields, owing to a trivial dispute, had been at loggerheads for years and as time went on the feeling became more bitter, until they even forbade their children ... The Wilkinsons and Caulfields, owing to a trivial dispute, had been at loggerheads for years and as time went on the feeling became more bitter, until they even forbade their children playing together. The little ones, however, in their childish innocence, could not appreciate the odium of their elders, and Bobby Wilkinson and Nellie Caulfield became child lovers. This incensed Colonel Wilkinson, who tore the children apart, ordered Bobby never to be seen in her company again. The Colonel's action ignited the ire of the Caulfields and a furious conflict ensued, resulting in the shooting to death of George, the Colonel's youngest son, a boy of fourteen. From that time on the clans kept strictly to themselves. But love knows no clannishness, and, despite family hatred, Bob and Nellie remained lovers. After ten years, driven to desperation by this apparently insurmountable barrier, they elope and are married. Bob decides to brave the storm of his father's anger and present his wife, but the old Colonel drives him from the house, disowning him. Old Aunt Dinah and Uncle Daniel, the colored servants, were so attached to the young folks that they go with them. Two years later we find the little family, now increased by an infant son, having a hard of it. It is Christmas morning and no turkey for dinner. Old Aunt Dinah, believing in the efficacy of prayer, gets down on her knees in the kitchen to ask the good Lord to send them a bird. Uncle Daniel, touched by this demonstration of faith, takes a gun and determines to get a turkey at any hazard. Over the hills he goes, but his journey is hopelessly fruitless until he comes to the rear of the Colonel's house. Tillie, the cook, has just hung a fat turkey on a post outside the kitchen door. When Daniel sees it he can't resist the temptation. Back home he hustles and finds Dinah still at prayer, he lays the fowl on the floor beside her and sneaks out. When Dinah sees it she surely thinks it was due to her prayers. Well, the turkey is cooked and an old-fashioned Christmas anticipated. Meanwhile the Colonel has discovered his loss and tracks the thief to Bob's estate. Entering, a tragedy seems inevitable, but when the old Colonel sees the young one, his grandson, in the cradle, his heart goes out to it and the feud ends then and there. All hands sit down and enjoy a real Merry Christmas dinner. English USA     2015-08-29 00:33:15.610000000   movie
686 tt0000686   Fiestas del carnaval de 1908 en Barcelona   1908            Documentary, Short      Fructuós Gelabert   Fructuós Gelabert                                   Spain       2015-11-09 14:24:29.583000000   movie

我得到了这个错误:

代码语言:javascript
运行
AI代码解释
复制
>     Error in fread(input = "../data.txt", sep="\t"  :    Expected sep ('  ') but new line, EOF (or other
> non printing character) ends field 20 when detecting types (   first):
> 684   tt0000684   Father Gets in the Game 1908        10 min  Short,
> Comedy    1908-10-10  D.W. Griffith   D.W. Griffith   Mack Sennett, Harry
> Solter, George Gebhardt, Linda Arvidson       5.1 39      "You have got to keep
> up with the bandwagon or quit." This never impressed old Wilkins so
> forcibly as when his son and daughter give him the go-by, stamping him
> as a "has-been," and away ...     "You have got to keep up with the
> bandwagon or quit." This never impressed old Wilkins so forcibly as
> when his son and daughter give him the go-by, stamping him as a
> "has-been," and away out of the game. Even Mrs. Wilkins, who is as
> vivacious as a widow, snubs him. He keenly feels his condition and
> resolves to alter it. With this in view, he enlists the services of
> Professor Dyem, the celebrated Dermatologist and Tonsorial Artist.
> After a session with the Professor, beheld the transmogrified Wilkins.
> W

我该怎么解决它呢?

EN

回答 2

Stack Overflow用户

发布于 2016-12-20 12:22:46

在这里,我不能100%确定数据中的错误是什么,但请尝试使用以下命令运行代码

代码语言:javascript
运行
AI代码解释
复制
data = fread(input = "../data.txt", sep = "\t", fill = TRUE)

在fread选项中。我也遇到了类似的错误,似乎fread在识别我的列分隔时遇到了麻烦。将fill设置为true允许fread填充任何丢失的数据-至少这样您就可以检查结果数据框并找出奇怪的地方。

票数 4
EN

Stack Overflow用户

发布于 2018-06-13 07:19:49

在语法中添加fill = TRUE

发生了什么:数据中的行的长度不相等。使用此语法时,将隐式填充空白字段。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35518401

复制
相关文章
Xcode 8新功能介绍
概述 Xcode 8正式版在9月13日已经推送给开发者下载,下载之后就出现了很多编译错误,之前的插件也不能用了,但是发现Xcode8把好多不错的插件功能整合到自身了,感觉这点也挺不错。 结合自己遇
xiangzhihong
2018/02/05
1.7K0
Xcode 8新功能介绍
cleanmymac X有哪些新功能?有必要下载安装吗
CleanMyMac X是一款集所有功能于一身的先进程序卸载清理器,只需两个简单步骤就可以把系统里那些乱七八糟的无用文件统统清理掉,节省宝贵的磁盘空间。CleanMyMac为您喜爱的东西腾出空间。它不仅有着赏心悦目的UI交互页面,更有着强大的“超能力”。无论是清理、优化、软件管理它都能手到擒来。它的操作也十分简单。无论是谁从都可以一次上手。
用户7442547
2023/01/25
8200
YARN的机架感知功能
最近几天做Hadoop机架感知功能时,在网上可以找到很多关于HDFS机架感知的资料,但是对于YARN机架感知的介绍却很少。这篇文章最主要就是说明机架感知功能对于YARN来说起到的作用,若有理解的偏差请指正。谢谢。
醉独醒
2022/05/27
1.2K1
视频智能审核系统的功能 智能审核系统靠谱吗
在这个技术十分发达的时代里,智能的技术可以融入在各个场景当中。尤其是视频智能审核系统,最常应用的是在各个直播平台当中。直播行业是非常流行的,很多平台都开通了直播的功能,但是为了平台的直播内容是绿色且合法的,平台就需要一个审核系统时刻检查各个直播间以及发布视频的内容。
用户8715145
2021/12/31
3.5K0
TensorFlow Hub 更新了,有你期待的功能吗?
自Google推出 TensorFlow Hub 已有一年半了,TensorFlow Hub 是一个开源代码库,可以使用 Google 和 DeepMind 发布的预训练模型。自推出以来,Google发布了数百个模型,有些是通用模型,并可针对特定任务进行微调,而一些模型则更为专业,即使在数据较少或计算能力较弱的情况下,也可以帮助您获得更快、更智能的 ML 应用。
CV君
2020/02/21
1.2K0
XCode新增数据转换功能(导数据)
用法: DAL.AddConnStr("xxgk", "Data Source=192.168.1.21;Initial Catalog=信息公开;user id=sa;password=Pass@word", null, "mssql"); var dal = DAL.Create("xxgk"); DAL.AddConnStr("xxgk2", "Data Source=XXGK.db;Version=3;", null, "sqlite"); File.Delete("XXGK.db"); /
大石头
2018/01/15
7650
Kubenetes NUMA拓扑感知功能介绍
最近的工作内容中涉及到了 NUMA 感知相关的功能,之前没有特意去看过 kubelet 相关部分的实现,也是趁此机会把落下的补补。在看代码的过程中,NUMA 感知部分的逻辑尤其涉及到一些位操作的部分,看的让人头疼,于是从网上搜了搜有关原理的介绍,恰好在官网找到一篇 blog,看完之后再去看代码就会豁然开朗。此篇是对原文的翻译,想阅读原文的可以直接到这里。
李鹤
2023/03/28
1.2K0
Kubenetes NUMA拓扑感知功能介绍
思维的边界,认知智能,从感知智能迈向认知智能
前言:我们正处在认知智能的起步的阶段,还有很多未知的因素,也不知道未来往哪走,但是有一条,无非是要么从知识,要么图谱、要么融合,但是可用肯定前景是无限的。这里有很多的机会,把我们的认知智能,搜索、问答问题、推理这些东西用在工业互联网的很多场景里面,认知智能技术,搜索、回答问题、推理的这些数据用在工业借的很多场景里,认知智能技术蕴藏着巨大的前景。
小马哥学JAVA
2022/12/15
9651
从态势感知到人工智能
在某安全大会上,公司A、B、C三家公司的员工碰到一起聊技术,碰巧3人都在做“态势感知系统”,但是聊着聊着发现:
泉哥
2019/07/18
1.5K0
从态势感知到人工智能
智能汽车车身感知系统详解
本文主要针对车身感知定位系统进行介绍,车身感知主要是感知车辆位置、行驶速度、姿态方位等信息,下文分别介了绍惯性导航、卫星导航系统和高精度地图三种主要的定位技术的发展情况,最后对多融合的车身感知定位系统及发展趋势进行介绍。
一点人工一点智能
2023/03/08
1.2K0
智能汽车车身感知系统详解
Acrobat DC Mac 2023 新版发布,有你期待的功能吗?
Acrobat DC 2023是一款功能强大的PDF文档处理软件,Acrobat DC Mac 2023现已发布,下面我们就来全面了解 一下Acrobat DC Mac 2023 有哪些新功能。
快乐的小丸子
2023/03/19
1K0
人工智能和自动化有区别吗? | 拔刺
自动化这个概念,是由福特汽车公司的机械工程师哈德在1946年的时候提出。理论上自动化是指机械设备系统或整个生产管理过程,在尽可能少用人的情况下,按照既定要求自动工作,实现预期的目标。
镁客网
2018/08/16
1.7K0
人工智能和自动化有区别吗? | 拔刺
Xcode 11 Asset新增自定义color功能
Color可视化定义一直是我期待的内容,以前都是一个文件管理颜色。Xcode 11.2 Asset资源管理新增了一些资源管理,比如这个Color管理。 新建自定义Color ---- 和新增图片一
星宇大前端
2020/01/13
9540
Xcode 11 Asset新增自定义color功能
通往人工智能的感知运动之路
可以说智力始于大约5.5亿年前的寒武纪,当时有了第一只可以移动的多细胞生物。移动给它带来了优势,因为它可以在不同的地方找到食物。但如果你想在不同的地方移动和寻找食物,你需要感知,你需要知道去哪里,这意味着你需要有某种视觉系统或感知系统。就像Gibson所说的:“We see in order to move and we move in order to see.”
用户1324186
2023/09/09
2010
通往人工智能的感知运动之路
数字时钟校时功能_公务员考试考场有钟表吗
医院、学校网络时间同步显示系统是由高精度GPS(北斗)网络母钟、高品质,高稳定性系统网络子钟、智能化控制设备及其它配套设备组成的计时和时钟显示系统,其作用是为保证校园或医院网络提供标准统一的时间服务.
全栈程序员站长
2022/09/20
5940
感知人工智能操作系统
AI即人工智能的又一波浪潮来了。机器学习,深度学习,神经网络,语音识别,图像识别...... 常常充斥我们的耳目。不论是AI赋能产业,还是AI改变生活,有的人停留于想象,有的人却在付诸实践。
半吊子全栈工匠
2019/03/11
1.6K0
感知人工智能操作系统
想学人工智能,有必要出国读本科或硕士吗?
笔者硕士毕业于北京大学计算机专业,期间有幸申请到了澳洲国立大学(Australian National University,简称ANU)的交换机会,对国内外人工智能教育均有所体验。毕业后,有四年一线大数据和人工智能从业经验,对AI行业形成了一些个人理解。
PP鲁
2019/12/26
2.5K0
从感知智能跨越到认知智能,NLP领域要做哪些创新?
欢迎大家关注「澜舟科技」公众号,加入孟子开源社区,一起探索 NLP 领域的前沿技术!
澜舟科技
2022/06/14
7830
从感知智能跨越到认知智能,NLP领域要做哪些创新?
《模式识别与智能计算》感知机模型
感知机模型 按照统计学三要素来写的话: 模型:符号函数 策略:损失函数;误点到超平面的距离之和 算法:利用梯度下降算法进行求解 感知机原理: 感知机模型用来线性判别数据集,什么意思呢就是用一超平面来隔断两个不同的类别,超平面在二维的数据集中就是一条直线,在三维的数据集中就是一个平面,假设有n维的数据,那么划分的超平面为(n-1)维度。如下图二维和三维的情况,蓝色部分为超平面:
Max超
2020/02/13
6130
Apple 系统正式版要发布了,有你期待的功能吗?
Apple操作系统每年例行升级时间到,每年都说的那么牛B,不管是IOS还是Mac os功能已经曝光的差不多了,你需要的功能有出现吗? 每年对系统的升级,其实还是很期待的,但是发现,Apple的系统现在越来越关注一些高科技,很多接地气的使用功能一直没有,还是让人很失望的。 说一说新版系统对我的吸引力吧。 IOS IOS11的新功能:https://www.apple.com/cn/ios/ios-11/ 相机扫码 这个应该是最喜欢的功能了. 我再也不用通过微信扫码,然后safri打开跳转了。 文件管理App
itmifen
2018/04/16
8830

相似问题

Apache Zeppelin有智能感知功能吗?

110

智能感知在XCode中工作吗?

21

附加信息的XCode智能感知

22

像VSCode一样,WebStorm也有智能感知功能吗?

10

Xcode有代码导航功能吗?

52
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文