That's a clever use of gsubfn. Here is a very minor simplification using
the same code but representing it in formula notation and sprintf:
gsubfn('([^\t]+)\t', ~ sprintf("%s%*s", x, 8-nchar(x)%%8, " "), tmp)
On Tue, Dec 9, 2008 at 12:51 PM, Greg Snow <[EMAIL PROTECTED]> wrote:
> This is basica
This is basically your approach, but automated a bit more than you describe:
library(gsubfn)
tmp <-
strsplit('one\ttwo\nthree\tfour\n12345678\t910\na\tbc\tdef\tghi\n','\n')[[1]]
tmp2 <- gsubfn('([^\t]+)\t', function(x) {
ln <- nchar(x)
nsp <- 8-(ln %% 8)
sp <- paste( rep(' ', nsp), colla
On Tue, Dec 9, 2008 at 10:39 AM, Dennis Fisher <[EMAIL PROTECTED]> wrote:
> 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 t
3 matches
Mail list logo