I should write a txt file with a specific format based on fixed-width columns (e.g. 1st variable in the columns 1-8, 2nd variable in the columns 9-15...).
The original data have different length and they have to be put on the right of the assigned columns. For example: the values "-15.96" and "12.489" have to be written in the columns 1-8 of the first and the second line, while "-872.6" and "1723.6" in the columns 9-15. This will be:
123456789012345 (n columns)
-15.96 -872.6
12.489 1723.6
How could I do that with R? Now I have a simple table like this:
x <- data.frame(a= sample(-500.5:500.8,4),
b= sample(-250.6:420.9,4))