Mark Fingerle 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 c
The following base R code does roughly what Bert suggests. It does
no checking that the data is in the format you describe. The
split-by-cumsum
trick is a handy idiom.
# lines <- readLines(yourFile), or, for this example:
lines <- c("#One","X Y Z","1 2 3","4 5 6","",
"#Two", "X Y
One approach would be to use ?readLines to read the lines into a
character vector. You could then use indexing to remove all the blank
and header (lines beginning with "image") lines. You can now find the
indices of where the separate data blocks begin (they all begin with
"#", right?) and then seq
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
4 matches
Mail list logo