[R] read.frame
Alec Stephenson
astephen at efs.mq.edu.au
Thu Jul 8 05:24:20 CEST 2004
The help file on the intersect function says
Performs set union, intersection, (asymmetric!) difference,
equality and membership on two vectors.
and so intersect(s[,1],c[,1]) is probably what you want.
Alec
Alec Stephenson
Department of Statistics
Macquarie University
NSW 2109, Australia
>>> S Peri <biocperi at yahoo.com> 07/08/04 12:56pm >>>
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
More information about the R-help
mailing list