I need to save data in fixed-width format without headers and reading the
help archive leads me to believe that sprintf is pretty much the only way to
do this.  My question is, is there anyway to change the output so the text
in each column is left justified instead of right justified?  My code sample
is below where comb is the data frame.  TIA, Roger


out <- sprintf("%6s %22s %8s %15s %7s %5s", comb$tic,
substr(as.character(comb$conm),
1, 22), comb$cusip, comb$type, comb$exchange, comb$currency)
write.table(out, file="c:/pit/portia_test.txt", row.names=FALSE,
col.names=FALSE, quote=FALSE)

        [[alternative HTML version deleted]]

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to