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

From: Sean O'Riordain <sean.oriordain_at_gmail.com>
Date: Sun 28 Aug 2005 - 02:57:40 EST

?sprintf

more C than fortran, but you get the idea :-)

cheers!
Sean

On 27/08/05, Duncan Golicher <dgoliche@sclc.ecosur.mx> 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@sclc.ecosur.mx
>
> ______________________________________________
> R-help@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
>



R-help@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 Received on Sun Aug 28 03:27:47 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:00:58 EST