supressing linefeed at end of file
Hello, I want to do simulations with an external simulation model. For this purpose I wrote a R-script which makes the pre- and post-processing of the data (generate scenarios, analyze results). The R-script writes the input file for the simulation with e.g. write(x, file="test.dat", ncolumns=10) The problem is, however, that this command (and even constructions with cat) will add a linefeed after the last line of data. Unfortunately the simulation program however is very stupid, as it does not allow a linefeed after the last line. It interprets the linefeed after the last line of data as an empty line and will fail. I did not find anything concerning this problem in the R-data.pdf manual. A first solution was to use grep to eliminate the empty line, but the R-script should run not only on linux, but also on windows machines without cygwin, perl or similar. Is there a simple "R only" solution? Otherwise I should write a special C program. Thanks in advance! Thomas Petzoldt
Dr. Thomas Petzoldt Dresden University of Technology Institute for Hydrobiology 01062 Dresden mailto:petzoldt at rcs.urz.tu-dresden.de http://www.tu-dresden.de/fghhihb/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._