[R] prefixing list names in print

Laurent Deniau laurent.deniau at cern.ch
Wed Aug 9 11:39:13 CEST 2006


bogdan romocea wrote:
> A simple function will do what you want, customize this as needed:
> lprint <- function(lst,prefix)
> {
> for (i in 1:length(lst)) {
>   cat(paste(prefix,"$",names(lst)[i],sep=""),"\n")
>   print(lst[[i]])
>   cat("\n")
> }
> }
> P <- list(A="a",B="b")
> lprint(P,"Prefix")

I thought that there is a way to 'setup' print.

Thanks.

ld.



More information about the R-help mailing list