Given a data frame:
set.seed(1)
df <- data.frame(a=1:10,b=runif(10),c=10*runif(10),d=101:110)
each columns format I expect:
%2s , %3.1f, %4.3f, %4.1f
how to apply the fmt on relative columns?
Supplement: the data frame will be saved as txt file which is the input data of another software. So I need to keep each columns as numeric data except the first column.
Maybe I ignored the format of R. Further explaination: format %3.1f means this cell is 3 character width with 1 decimal digit. It is a numeric ,not character (string). %2s mean output 2 width length character, etc..
quote = FALSEinwrite.table. - Roland