我想閱讀一個文件,其中每行代表一個包含日期,一些文本和數字的數據集。例如:如何在R中讀取特定格式的文件?
Fri Dec 11 12:40:01 CET 2015 Uptime: 108491 Threads: 2 Questions: 576603 Slow queries: 10 Opens: 2238 Flush tables: 1 Open tables: 7 Queries per second avg: 5.314
Fri Dec 11 12:50:01 CET 2015 Uptime: 109090 Threads: 2 Questions: 580407 Slow queries: 10 Opens: 2253 Flush tables: 1 Open tables: 6 Queries per second avg: 5.320
Fri Dec 11 13:00:01 CET 2015 Uptime: 109690 Threads: 2 Questions: 583895 Slow queries: 10 Opens: 2268 Flush tables: 1 Open tables: 8 Queries per second avg: 5.323
Fri Dec 11 13:10:01 CET 2015 Uptime: 110290 Threads: 1 Questions: 586891 Slow queries: 10 Opens: 2279 Flush tables: 1 Open tables: 6 Queries per second avg: 5.321
Fri Dec 11 13:20:01 CET 2015 Uptime: 110890 Threads: 2 Questions: 590871 Slow queries: 10 Opens: 2292 Flush tables: 1 Open tables: 5 Queries per second avg: 5.328
沒有一般分隔符(如在CSV),但格式可以被描述相當不錯,由於突片,charcters和文本都可以使用。
%DATESTRING%\tUptime: %uptime% Threads: %threads% Questions: %questions% Slow queries: %slow% Opens: %opens% Flush tables: %flush% Open tables: %otables% Queries per second avg: %qps%
是否有需要的格式的說明和文件,並填補了data.frame給定數據的功能?
我已經把它投入到excel中,把它固定在需要的地方,然後將它保存爲csv。 – TBSRounder
@rawr列名包含在行記錄中的事實對於我所使用的固定寬度是非標準的... – MichaelChirico
@MichaelChirico是的你是對的 – rawr