Re: [R] problem in matching numbers in two variables

2012-04-29 Thread Berend Hasselman
On 29-04-2012, at 08:48, sagarnikam123 wrote: > 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 Did you try the other solutions that were suggested? Berend ___

Re: [R] problem in matching numbers in two variables

2012-04-29 Thread John Kane
r-help@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 > > -- &g

Re: [R] problem in matching numbers in two variables

2012-04-29 Thread sagarnikam123
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 ma

Re: [R] problem in matching numbers in two variables

2012-04-28 Thread Rui Barradas
Hello, Why not == ? x == y which(x == y) Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/problem-in-matching-numbers-in-two-variables-tp4594912p4594976.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] problem in matching numbers in two variables

2012-04-28 Thread John Kane
I think this works bu there probably is a better way. xy <- x %% y which(xy != 0) John Kane Kingston ON Canada > -Original Message- > From: sagarnikam...@gmail.com > Sent: Sat, 28 Apr 2012 08:28:39 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] problem in matching numbers in t

Re: [R] problem in matching numbers in two variables

2012-04-28 Thread Berend Hasselman
On 28-04-2012, at 17:28, sagarnikam123 wrote: > i want to compare two variables (having numbers) serially for > matching/dismatching > both having equal length > >> x > [1] 2 2 1 2 3 2 2 2 2 3 3 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 3 2 3 2 2 2 1 > 2 2 > [38] 2 2 2 3 2 3 2 2 1 2 2 2 2 1 1 1 3 2 2 2