Entering edit mode
Francois Pepin
★
1.3k
@francois-pepin-1012
Last seen 10.3 years ago
Hi Amrit,
please don't just e-mail me. The list is archived in case other other
people want to search for the same issue. Also other people can have
more advice and more time to offer it.
Also, please post a _reproducible_ code and the output of
sessionInfo().
With the following content, the code works just fine for me:
list1<-sample(1:100,50)
list2<-sample(1:100,50)
Since I have no clue what you have in list1 and list2, I'm going to
say
this is likely the issue.
Also, you can completely remove the for loop, making the code simpler
and quite a bit faster:
dooby.mat[,1] <- dooby.all%in%list1
dooby.mat[,2] <- dooby.all%in%list2
Francois
amrit karki wrote:
>
> Dear Francois pepin
> I used following code to construct venn diagram but it gave me the
> diagram and also gave me the number in set A and set b but could not
> enter number in Intersection. So, if you have time, i would like to
> request you to edit my codes. Thank you.
>
> my probel is i havr 1769 genes in set A only, 2292 genes in set B
only
> and 3451 (2100 from set B and 1351 genes from set A) genes are
common
> (in interesection) set only. So, would you mind to suggest how it is
> possible to construct venn diagram in r.
>
> list1 <-data.1[,1]
> list2 <-data.2[,1]
> dooby.all <- union(list1,list2)
> dooby.mat <- matrix(0,nrow=length(dooby.all),ncol=2)
> colnames(dooby.mat) <- c("Set A","Set B")
> for (i in 1:length(dooby.all)) {
> dooby.mat[i,1] <- dooby.all[i]%in%list1
> dooby.mat[i,2] <- dooby.all[i]%in%list2}
> dooby.ven <- vennCounts(dooby.mat)
> vennDiagram(dooby.ven)
>
> Thank you.
> With best regards.
> Amrit Karki
> Graduate student
>
>