From lukas.stadler at oracle.com  Thu Nov  9 16:34:49 2017
From: lukas.stadler at oracle.com (Lukas Stadler)
Date: Thu, 9 Nov 2017 16:34:49 +0100
Subject: [Rd] formatting raw vectors with names
Message-ID: <9779FEE0-79EE-493D-8599-74A103AA01B9@oracle.com>

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.

- Lukas


[Rd] formatting raw vectors with names
Lukas Stadler