[R] problem in matching numbers in two variables

John Kane jrkrideau at inbox.com
Sun Apr 29 14:09:39 CEST 2012


I think I misread the question.  Is this what you want
j <- c(1,1,2,2,3)
k <- c(2,1,1,1,1)

xx  <- j == k
which(xx == TRUE)


John Kane
Kingston ON Canada


> -----Original Message-----
> From: sagarnikam123 at gmail.com
> Sent: Sat, 28 Apr 2012 23:48:43 -0700 (PDT)
> To: r-help at r-project.org
> Subject: Re: [R] problem in matching numbers in two variables
> 
> No its not perfectly working see below
> 
>> j<-c(1,1,2,2,3)
>> k<-c(2,1,1,1,1)
>> j%%k
> [1] 1 0 0 0 0
> 
> problem comes when one of my sequence have 1
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/problem-in-matching-numbers-in-two-variables-tp4594912p4595849.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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!



More information about the R-help mailing list