Hi there I have two object on is a vector T and the other is dataframe C. vector T has more no of rows when comapred with a dataframe Ccolumn[,2].I want to find the the missing rows in dataframe C.That is those values that are not matchig in dataframe C[,2] Kindly give me suggestion on how to go about it. Ramya -- View this message in context: http://www.nabble.com/comparing-two-files-tp19337486p19337486.html Sent from the R help mailing list archive at Nabble.com.
?which which(C[,2]!= T) # untested --- On Fri, 9/5/08, Rajasekaramya <ramya.victory at gmail.com> wrote:> From: Rajasekaramya <ramya.victory at gmail.com> > Subject: [R] comparing two files > To: r-help at r-project.org > Received: Friday, September 5, 2008, 2:57 PM > Hi there > > I have two object on is a vector T and the other is > dataframe C. > vector T has more no of rows when comapred with a dataframe > Ccolumn[,2].I > want to find the the missing rows in dataframe C.That is > those values that > are not matchig in dataframe C[,2] > > Kindly give me suggestion on how to go about it. > > Ramya > > -- > View this message in context: > http://www.nabble.com/comparing-two-files-tp19337486p19337486.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code.__________________________________________________________________ [[elided Yahoo spam]]
?match> T.v <- sample(1:20) > C.df <- data.frame(a=1:10, b= sample(1:20, 10)) > T.v[1] 10 12 9 4 14 11 19 2 18 5 16 6 7 17 8 20 1 13 3 15> C.dfa b 1 1 10 2 2 17 3 3 8 4 4 5 5 5 2 6 6 16 7 7 19 8 8 7 9 9 18 10 10 14> # find the missing values > T.v[is.na(match(T.v, C.df[,2]))][1] 12 9 4 11 6 20 1 13 3 15>On Fri, Sep 5, 2008 at 2:57 PM, Rajasekaramya <ramya.victory at gmail.com> wrote:> > Hi there > > I have two object on is a vector T and the other is dataframe C. > vector T has more no of rows when comapred with a dataframe Ccolumn[,2].I > want to find the the missing rows in dataframe C.That is those values that > are not matchig in dataframe C[,2] > > Kindly give me suggestion on how to go about it. > > Ramya > > -- > View this message in context: http://www.nabble.com/comparing-two-files-tp19337486p19337486.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Hi there, See ?"%in%" Here is an example:> x=sample(1:10) > x[1] 2 1 10 5 4 7 3 6 8 9> y=sample(4:20) > y[1] 17 16 18 10 8 19 4 5 11 13 12 14 20 6 7 9 15> x[x%in%y] # "x" values present in "y"[1] 10 5 4 7 6 8 9 HTH, Jorge On Fri, Sep 5, 2008 at 2:57 PM, Rajasekaramya <ramya.victory@gmail.com>wrote:> > Hi there > > I have two object on is a vector T and the other is dataframe C. > vector T has more no of rows when comapred with a dataframe Ccolumn[,2].I > want to find the the missing rows in dataframe C.That is those values that > are not matchig in dataframe C[,2] > > Kindly give me suggestion on how to go about it. > > Ramya > > -- > View this message in context: > http://www.nabble.com/comparing-two-files-tp19337486p19337486.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]