Gabor,

> The real problem is how to create a list with given names
> and constant content.  

When this is your problem to solve, why don't you do the following?

as.constlist <- function(content, names){
        content <- rep(list(content), length=length(names))
        names(content) <- names
        content
}
nams <- letters[1:3]
v <- 1:2
as.constlist(v, nams)


Best 


Jens Oehlschlägel


> I find I need to do that and when I noticed
> a recent problem posted on r-help that required it I decided it was 
> time that I figured out a better way to do it.  I simplified the 
> problem for purpose of bringing out the error more clearly but it
> otherwise does stem from a real problem.
> 
> To illustrate, we will use this test data:
> 
>                nams <- letters[1:3]
>                v <- 1:2
> 
> The following will do it:
> 
>                L <- rep(list(v), length(nams))
>                names(L) <- nams
> 
> but I wanted a more compact expression.

-- 
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to