Re: [R] prefixing list names in print

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 09 Aug 2006 - 02:55:37 EST

On Tue, 8 Aug 2006, Laurent Deniau wrote:

> With
>
> print(list(A="a",B="b"))
>
> it displays
>
> $A
> [1] "a"
>
> $B
> [1] "b"
>
> I would like to add a common prefix to all the list tags after the $.

`prefix' ... `after'? You seem to want to prefix component names: why? What do you want for component $a$b$c? For unnamed components?  

> Pasting the prefix to the "names" does not work (appear after the $).
> For example if the prefix would be "P", it should display:
>
> P$A
> [1] "a"
>
> P$B
> [1] "b"
>
> I tried to add a "name" attribute to the list or to add a prefix="P" to
> print but nothing works. Any hint?

You will need to alter the C code to do this.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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.
Received on Wed Aug 09 03:03:51 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 09 Aug 2006 - 04:18:56 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.