[R] explanation of the problem..

arun smartpink111 at yahoo.com
Sat Mar 2 20:37:09 CET 2013


HI Utpal,

Alight, I will look into it.  I was under the impression that this is what you wanted:

dat1<- structure(list(V1 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L), V2 = c(1L,
1L, 1L, 1L, 1L, 1L, 0L), V3 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L),
    V4 = c(1L, 1L, 0L, 1L, 1L, 1L, 1L), V5 = c(1L, 1L, 1L, 1L,
    1L, 0L, 1L), V6 = c(1L, 1L, 1L, 0L, 1L, 1L, 1L), V7 = c(1L,
    1L, 1L, 1L, 1L, 1L, 1L), V8 = c(1L, 1L, 1L, 0L, 1L, 0L, 1L
    ), V9 = c(1L, 0L, 1L, 1L, 1L, 1L, 1L), V10 = c(1L, 1L, 1L,
    1L, 1L, 1L, 1L), V11 = c(0L, 1L, 1L, 1L, 1L, 1L, 1L), V12 = c(1L,
    1L, 1L, 1L, 1L, 1L, 1L), V13 = c(1L, 1L, 1L, 1L, 1L, 1L,
    1L)), .Names = c("V1", "V2", "V3", "V4", "V5", "V6", "V7",
"V8", "V9", "V10", "V11", "V12", "V13"), class = "data.frame", row.names = c(NA,
-7L))
dat2<- dat1[,1:4]
 dat2[4,]<- c(3,2,3,1)
 dat2[6,]<- c(3,3,3,3)


 dat2
#  V1 V2 V3 V4
#1  1  1  1  1
#2  1  1  1  1
#3  1  1  1  0
#4  3  2  3  1
#5  1  1  1  1
#6  3  3  3  3
#7  1  0  1  1

res<-
 lapply(2:ncol(dat2),function(i) {x1<- 
combn(names(dat2),i);unlist(lapply(1:ncol(x1), function(i) {x2<- 
dat2[,x1[,i]];dim(x2[!as.logical(rowSums(x2==0)),])[1]}))})
res
#[[1]]
#[1] 6 7 6 6 5 6

#[[2]]
#[1] 6 5 6 5
#
#[[3]]
#[1] 5


A.K.




________________________________
From: Utpal Bakshi <utpalmtbi at gmail.com>
To: arun <smartpink111 at yahoo.com> 
Sent: Saturday, March 2, 2013 2:14 PM
Subject: Re: explanation of the problem..


may be you could use the specaccum function of vegan package for permutations.. the function is shown in pan genome script file..




On Sun, Mar 3, 2013 at 12:39 AM, arun <smartpink111 at yahoo.com> wrote:

Another problem, is that with this combinations of many columns will be computationally intensive. 
>
>
>
>
>
>
>________________________________
> From: Utpal Bakshi <utpalmtbi at gmail.com>
>To: arun <smartpink111 at yahoo.com> 
>Sent: Saturday, March 2, 2013 1:54 PM
>
>Subject: Re: explanation of the problem..
> 
>
>
>Hi Arun.. yes... even if the number is greater than 1 (what ever it may be), it will still count as 1.. 
>
>
>for example 
>
>
>
>
>dat1
>#  V1 V2 V3 
>#1  3  1  2  
>#2  1  16  0  #3  1  0  1  
>
>
>will considered as same as
>
>
>dat1
>#  V1 V2 V3 
>#1  1  1  1  
>#2  1  1  0  #3  1  0  1 
>
>



More information about the R-help mailing list