[R] read.frame

Alec Stephenson astephen at efs.mq.edu.au
Thu Jul 8 09:25:40 CEST 2004


For E:
e <- e[,1] ; uni <- union(c[,1],union(s[,1],h[,1]))
Then e[!match(e, uni, 0)] should get you there. 

Alec

Alec Stephenson                                               
Department of Statistics
Macquarie University
NSW 2109, Australia 

>>> S Peri <biocperi at yahoo.com> 07/08/04 02:41pm >>>
Dear Alec, 
 Thank you for your response and it worked. Further, I
have another mathematical problem. I apologize ahead
as this question is not apt for this list. I am a
biologist working at Johns Hopkins School of Medicine.

As I listed in my previous e-mail (attached below)I
mentioned I have 4 protein sets.  I am now trying to
calculate the combinatorics of these sets.  My
ultimate aim is to draw a venn diagram and find out
the proteins that are unique to set C,S,E and H. 
 I drew a venn diagram graph and I am banging my head
to deduce the combinations.  It is easy for me to
deduce the intersections - that means the protein
entries that are present in common. However, it proved
very difficult to deduce the following: 

I could calculate the following:

NP_*** present in both C and E (C intersection E)
NP_*** present in both C and H (C intersection H)
NP_*** present in both C and S (C ^ S)
NP_*** present in both E and H (E ^ H)
NP_*** present in both E and S (E ^ S)
NP_*** present in both H and S (H ^ S)

NP_*** present in C, E and H (C^E^H)
NP_*** present in C, H and S (C^H^S)
NP_*** present in E, H and S (E^H^S)
NP_*** present in E, S and C (E^S^C)


It is very difficult for me to deduce the following:

NP_**** entries specific to E
NP_**** entries specific to H
NP_**** entries specific to S


I waster many pages but could not derive some solution
to get unique elements for sets, s,e,h,and C.

Can any one help me by suggesting some way to get
these.

Thank you and I apologise again for posting the wrong
question. 

SP


--- S Peri <biocperi at yahoo.com> wrote:
> Hello group, 
>   I am learning R and I am new to many concepts.I
> face
> the following errors when I am trying to execute the
> following. I have 4 text files with protein
> accession
> numbers. I wanted to represent them in a venn
> diagram
> and for that I using intersect and setdiff
> functions.
> 
> My data looks like this:
> 
> file1.txt (c):
> NP_000005
> NP_000020
> NP_000030
> NP_000053
> 
> file2.txt(e):
> NP_000005
> NP_000020
> NP_000030
> NP_000031
> NP_000053
> NP_000055
> NP_000087
> 
> file3.txt(h):
> NP_000005
> NP_000020
> NP_000030
> NP_000053
> NP_000055
> NP_000057
> NP_000087
> 
> file4.txt (s):
> NP_000005
> NP_000020
> NP_000030
> NP_000033
> NP_000053
> NP_000055
> NP_000087
> NP_000168
> 
> 
> Now I did the following FIRST time:
> c=read.table("file1.txt")
> e=read.table("file2.txt")
> s=read.table("file4.txt")
> h=read.table("file3.txt")
> 
> > class(c)
> [1] "data.frame"
> > class(s)
> [1] "data.frame"
> > CiS=intersect(c,s)
> > CiS
> NULL data frame with 0 rows 
> ##### Why am I getting NULL data error. I know there
> are common elements between c and S. ##########
> 
> > CiS<-intersect(read.matrix(c,s))
> Error in unique(y[match(x, y, 0)]) : Argument "y" is
> missing, with no default
> > CiS<-intersect(read.frame(c,s))
> Error in unique(y[match(x, y, 0)]) : Argument "y" is
> missing, with no default
> 
> ##### Why am I getting this error.
> 
> 
> 
> Second thing I did:
> 
> I loaded the data as data.frame instead
> read.table(). 
> Again I never get intersection of C,E and S,H. 
> 
> 
> Can any one please help me. 
> thank you
> 
> SP
> 
> ______________________________________________
> 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 
>

______________________________________________
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