[R-sig-Geo] Digit positions in writing files
马可
wul1984 at gmail.com
Thu Dec 2 06:40:10 CET 2010
Thanks Robert,sprintf works exactly what I want~
Marco
2010/12/2 Robert J. Hijmans <r.hijmans at gmail.com>:
> Have a look at sprintf
>
> Robert
>
> On Wed, Dec 1, 2010 at 2:41 AM, 马可 <wul1984 at gmail.com> wrote:
>> Hi, list:
>>
>> I am processing a kind of data which has very strict format on digit
>> position, ie., for the first column, the last digit should be in column 5,
>> the second in column 10, and 16, 24, 32 for the 3rd, 4th, and 5th,
>> respectively. Here is the segment:
>>
>> 29 -999 1051 69.58 23.53
>> 30 -999 1052 70.67 23.67
>> 31 -999 1053 70.68 23.68
>> 32 -999 1055 71.10 24.00
>> .......
>> 13642 -999 97890 -7.83 129.67
>> 13643 30 97900 -7.98 131.30
>> 13644 100 97980 -8.47 140.38
>> 13645 66 98132 20.80 121.85
>> 13646 -999 98133 19.27 121.47
>>
>> My aim is to replace the coordinates of certain rows using new coordinates,
>> and put the whole file back into the same filee, but it seems that I can
>> only get constant spaces between each column if I use write.table, with
>> sep=' '. So, my question is, is there any way that I could get the desired
>> format? By the way, I have more than 10,000 rows in each file (day), and 365
>> days for each year, I think for me, R is the only way to do this.
>>
>> Thanks in advance~
>>
>> Best regards~
>>
>> Marco
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
--
-------------------------------------------------------
Chinese Ecological Research Network,
Institute of Geographical Science and Natural Resource Research,
Chinese Academy Of Science,
100101, Beijing
Tel: (86)-10-64880 9809
More information about the R-sig-Geo
mailing list