Colleagues,

Platform: OS X (but issue applies to all platforms)
Version: 2.8.0

I have a mixture of text and data that I am outputting via R to a pdf document (using a fixed-width font). The text contains tabs that align columns properly with a fixed-width font in a terminal window. However, when the PDF document is created, the concept of a tab is not invoked properly and columns do not align.

I could use brute force as follows:
1.  identify lines of text containing tabs
2.  strsplit on tabs
3. count characters preceding the tab, then replace the tab with the appropriate number of spaces (e.g., if the string preceding the tab has 29 characters, add 3 spaces), then paste(..., sep="")

However, I am sure a more elegant approach exists. Can anyone offer one?

Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

______________________________________________
R-help@r-project.org 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