[R] paste dimnames problem

Peter Wolf s-plus at wiwi.uni-bielefeld.de
Tue Apr 27 12:06:15 CEST 2004


Try:
<<*>>=
n<-list(c("new","old","prg"),
        c("04h","24h", "48h"),
        c("000mM","010mM","025mM", "050mM", "100mM"))
unlist(lapply(1:3,function(x) paste(n[[1]][x],n[[2]][x],n[[3]][x],sep=".")))

@
output-start
Tue Apr 27 12:03:57 2004
[1] "new.04h.000mM" "old.24h.010mM" "prg.48h.025mM"
output-end

Peter Wolf


Arne.Muller at aventis.com wrote:

>Hello,
>
>I've the following list n:
>  
>
>>n
>>    
>>
>[[1]]
>[1] "NEW" "OLD" "PRG"
>
>[[2]]
>[1] "04h" "24h"
>
>[[3]]
>[1] "000mM" "010mM" "025mM" "050mM" "100mM"
>
>where
>
>n <- dimnames(some.multidim.array)
>
>I'm trying to define a generic function that generates meaningful names from this list, e.g. NEW.04h.000mM would be the first name, then NEW.04h.010mM, ... . Overall this would generate 30 names (3*2*5). Here, this would be 3 cascaded loops, but the dimensions of the array should be flexible.
>
>What would suggest?
>
>	I'm happy for your comments,
>	+regards,
>
>	Arne
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list