[R] writing to a fixed format (fortran) file

Jean Eid jeaneid at chass.utoronto.ca
Sat Aug 27 18:52:02 CEST 2005


why not write.table with sep="\t"

On Sat, 27 Aug 2005, Duncan Golicher wrote:

> Could anyone help with what should be a simple task? I have data as a
> fixed format (fortran) table. I  have no trouble getting it into R using
> read.table. Each column is separated by a space, including the first
> column that begins with a space, and aligned. It reads into R as if
> separated by tabs. However I want to manipulate two columns of data then
> write the results out into exactly the same fortran format for use in
> another program.  It should be simple, but I've tried a variety of
> experiments with print, cat and format, none of which have come close.
>
> Here is a sample of the data.
>
>   1  1    1  19.5  2.42 0.02   5.81   9.7   0.4 102.  4.8  320.   4.8
>   2  1    1   0.0  0.00 0.00   0.00   4.7  -4.0 178.  5.4  301.   0.2
>   3  1    1   8.2  1.64 0.08   6.93   6.9  -3.6 275.  2.7   84. -11.1
>   4  1    1   0.0  0.00 0.00   0.00  20.6  -4.8 221.  5.6  327. -10.4
>   5  1    1   0.0  0.00 0.00   0.00  11.6   8.2 168.  4.3  269.   6.8
>   6  1    1   0.0  0.00 0.00   0.00  18.7  16.9 155.  5.6  287.   8.2
>   7  1    1   0.0  0.00 0.00   0.00   7.0   2.1 195.  2.7   22.   0.1
>   8  1    1   0.0  0.00 0.00   0.00  17.6   6.5 281.  2.0  146.   1.5
>   9  1    1  41.2  1.54 0.82   6.96  12.2   7.8 268.  5.5  356.   4.5
>  10  1    1   0.0  0.00 0.00   0.00  14.6  -1.4 250.  3.6  344.   6.4
>  11  1    1   0.0  0.00 0.00   0.00  14.5  -3.7 300.  0.0    0. -16.9
>  12  1    1   0.0  0.00 0.00   0.00   8.8  -2.6 308.  0.0    0.   2.9
>  13  1    1   0.0  0.00 0.00   0.00   6.4   1.6 226.  3.3  335.   3.8
>
> --
>
> Dr Duncan Golicher
> Ecologia y Sistematica Terrestre
> Conservación de la Biodiversidad
> El Colegio de la Frontera Sur
> San Cristobal de Las Casas,
> Chiapas, Mexico
>
> Email: dgoliche at sclc.ecosur.mx
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list