[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    Re: [Rd] formatting raw vectors with names
From:       Martin Maechler <maechler () stat ! math ! ethz ! ch>
Date:       2017-11-09 17:42:42
Message-ID: 23044.37778.615463.123646 () stat ! math ! ethz ! ch
[Download RAW message or body]

> > > > > Lukas Stadler <lukas.stadler@oracle.com>
> > > > > on Thu, 9 Nov 2017 16:34:49 +0100 writes:

    > I think there's a bug concerning the formatting of raw vectors with names:
    >> structure(as.raw(1:3), .Names = c("a", "bbbb", "c"))
    > a bbbb    c 
    > 01 02 03 
    >> structure(1:3, .Names = c("a", "bbbb", "c"))
    > a bbbb    c 
    > 1    2    3 

    > The problem is that EncodeRaw does not honor the requested width, in fact it \
doesn't even get the width as a parameter.  > An easy fix would be to change:

    > static void printNamedRawVector(Rbyte * x, int n, SEXP * names)
    >    PRINT_N_VECTOR(formatRaw(x, n, &w),
    >                   Rprintf("%s%*s", EncodeRaw(x[k], ""), R_print.gap,""))

    > to

    > static void printNamedRawVector(Rbyte * x, int n, SEXP * names)
    >    PRINT_N_VECTOR(formatRaw(x, n, &w),
    >                   Rprintf("%*s%s%*s", w - 2, "", EncodeRaw(x[k], ""), \
R_print.gap,""))

    > in printvector.c:314.

Thank you, Lukas,

all you show and say seems very convincing to me,
notably the fix as well.

I'll deal with this, after a little testing.
If the effect is small in "package - space", it may be ported to
R-patched to become R 3.4.3  in three weeks.

Martin

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic