Hello !!
I have this problem:
A matrix on True/False
and as many numerical vectors as columns,
but of different length. What I 'd like to get is this:

set.seed(12)
> dat <- as.data.frame(matrix(as.logical(sample(T:F, 30, T)),5,6))
> colnames(dat) <- letters[1:6]
> rownames(dat) <- paste(letters[1:5],1:5, sep="")
> dat
       a     b     c     d     e     f
a1  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
b2 FALSE  TRUE FALSE  TRUE FALSE FALSE
c3 FALSE FALSE  TRUE FALSE  TRUE  TRUE
d4  TRUE  TRUE  TRUE FALSE FALSE  TRUE
e5  TRUE  TRUE  TRUE  TRUE  TRUE FALSE
> 
> v1 <- c(1:3)
>  names(v1) <- c("a1", "d4", "e5")
> v2 <- c(1:4)
> names(v2) <- c( "a1","b2", "c3","e5")
> 
v1
a1 d4 e5 
 1  2  3 
> v2
a1 b2 c3 e5 
 1  2  3  4 
> 


Desirable Output

dat 
         a        b     c    d   e   f
a1      1      1 .....
 b2     NA    2   .....
c3      NA    NA    
d4      2       3
e5      3       4   ......

 
Any suggestion ,
Thank you 

Anna

Anna Freni Sterrantino
Ph.D Student 
Department of Statistics
University of Bologna, Italy
via Belle Arti 41, 40124 BO.



      
	[[alternative HTML version deleted]]

