[R] Reading multiple tables from one .txt doc

Loris Bennett loris.bennett at fu-berlin.de
Wed May 4 08:57:37 CEST 2016


Mark Fingerle <mark.fingerle at brainlab.com> writes:

> Dear all,

> I have a .txt file which contains multiple tables and I would like to
> read these tables separately in order to create graphs for each one.
> The tables are separated by a blank line, have a variable number of
> lines, fixed nr. Of rows, have a header and a comment above the header
> (#) which contains a specific word that identifies each table. (see
> example below). It would be possible to change the layout of the .txt
> data a bit (Add a word, remove comment etc..)

> I would be extremely grateful if anyone could help me with this daunting task :-)
> Example:
> # CoordA
> Image    X             Y             Z             MeasuredMove MachineMove
> vf_36.png            -114.345475       -89.043448         556.073402         0             0
> vf_37.png            -111.118715       -89.978534         606.040764         50.080172           50.000000
> vf_38.png            -107.911209       -90.901958         656.025557         50.096111           50.000000
> vf_39.png            -104.693931       -91.814392         705.982620         50.068868           50.000000
> vf_40.png            -101.459549       -92.730113         755.983835         50.114082           50.000000
>
> # CoordB
> Image    X             Y             Z             MeasuredMove MachineMove
> vf_36.png            -115.345475       -89.043448         556.073402         0             0
> vf_37.png            -115.118715       -89.978534         606.040764         50.080172           50.000000
> vf_38.png            -134.911209       -90.901958         656.025557         50.096111           50.000000
> vf_39.png            -164.693931       -91.814392         705.982620         50.068868           50.000000
> vf_40.png            -134.459549       -92.730113         755.983835         50.114082           50.000000
>
> # CoordC
> Image    X             Y             Z             MeasuredMove MachineMove
> vf_36.png            -168.345475       -89.043448         556.073402         0             0
> vf_37.png            -115.118715       -89.978534         606.040764         50.080172           50.000000
> vf_38.png            -146.911209       -90.901958         656.025557         50.096111           50.000000
> vf_39.png            -187.693931       -91.814392         705.982620         50.068868           50.000000
> vf_40.png            -185.459549       -92.730113         755.983835         50.114082           50.000000
>
> 	[[alternative HTML version deleted]]
>

This is not a solution if you really want separate graphs of the
individual tables, but you could add column "Coord", roll everything
into a single table and then create one or more facet plots from that.

Cheers,

Loris

-- 
This signature is currently under construction.



More information about the R-help mailing list