我有一个很大的.txt文件,看起来像这样:
Gaze Data - IviewTimestamp 810956901 OpenSesameTimeStamp 257744.0 GazeLeft 805.983062306 339.363433694 GazeRight 750.81981327 339.888070524 DistanceRight 639.665264821 DiameterLeft 3.46429749971 DiamaterRight 3.75813319059
Start Test Trial 0 @ TimeStamp 257748.0
Gaze Data - IviewTimestamp 810960906 OpenSesameTimeStamp 257749.0 GazeLeft 809.148226735 330.21241462 GazeRight 751.126827503 343.161895059 DistanceRight 639.985872532 DiameterLeft 3.45140040843 DiamaterRight 3.76736337177
Gaze Data - IviewTimestamp 810964910 OpenSesameTimeStamp 257752.0 GazeLeft 809.360660142 337.543186514 GazeRight 756.788085095 360.893417279 DistanceRight 640.324640647 DiameterLeft 3.46015956599 DiamaterRight 3.77027081809
字符串“开始测试试用版” 在文件中仅出现几次。当我使用read_table2
时,它会跳过“开始测试试用” 行。我使用grep("Start Test Trial, readLines(data)[1]
结合read_table2
的skip参数解决了这个问题。但是,这是一个缓慢的过程。还有其他方法只能导入带有首选字符串的行吗?
谢谢!