Re: [R] R intersect()

2016-06-28 Thread ch.elahe via R-help
Yes, found it. Thanks On Tuesday, June 28, 2016 4:57 PM, Duncan Murdoch wrote: On 28/06/2016 10:48 AM, ch.elahe via R-help wrote: > Hi all, > I have the following df: > > > licenseY :int 41006 41013 41044 41046 41067 41166 41202 41262 > 41274 41290 > licenseZ :int 41006

Re: [R] R intersect()

2016-06-28 Thread S Ellison
> licenseY :int 41006 41013 41044 41046 41067 41166 41202 41262 41274 > 41290 > licenseZ :int 41006 41013 41018 41044 41046 41067 4 41200 41262 > 41272 > ... I want a command to return me values from licenseY that are not in > intersect(). Does anyone know how should I do

[R] R intersect()

2016-06-28 Thread ch.elahe via R-help
Hi all, I have the following df: licenseY :int 41006 41013 41044 41046 41067 41166 41202 41262 41274 41290 licenseZ :int 41006 41013 41018 41044 41046 41067 4 41200 41262 41272 I needed the common values in both license columns so I used : intersect(df$licenseY

Re: [R] Intersect 2 lists+bring extra columns

2013-09-01 Thread jsteimle
I see how merge works now, and to answer my own question, I can have any number of columns of miscellaneous information I want. -- View this message in context: http://r.789695.n4.nabble.com/Intersect-2-lists-bring-extra-columns-tp4675136p4675146.html Sent from the R help mailing list archive

Re: [R] Intersect 2 lists+bring extra columns

2013-09-01 Thread jsteimle
Hi A.K. That is exactly what I was hoping to do. If you have the time, can you explain what the fruit[,-1] term means in the merge? Also, if I wanted to expand the number of columns to report to include a 4th column, let's call it flavor, how would I go about doing that? J.S. -- View this me

[R] Intersect 2 lists+bring extra columns

2013-09-01 Thread jsteimle
Hi everyone, I am pretty new to R, so be patient. I am trying to intersect 2 columns and in the rows that intersect, I want information from the 3rd column to be brought with it. I think it will be easier to explain with an example example.csv

Re: [R] Intersect 2 lists+bring extra columns

2013-09-01 Thread arun
HI, If I understand it correctly: fruit<- read.csv("example.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t")  res<-merge(fruit["reference"],fruit[,-1],by.x="reference",by.y="list")  res #   reference information #1 grapefruit    pink #2  lemon  yellow #3   pear   green If th

Re: [R] intersect() without discarding duplicates?

2010-05-21 Thread Jonathan
Thank you, David and Gabor, for the creative solutions, and for introducing me to pmin() Jonathan On Thu, May 20, 2010 at 9:55 PM, Gabor Grothendieck wrote: > Try this one liner. The first argument of rep is the sorted > intersection and the second argument is the calculated from the > paral

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread Gabor Grothendieck
Try this one liner. The first argument of rep is the sorted intersection and the second argument is the calculated from the parallel minimum of the counts of elements in a that are also in b and the counts of elements in b that are also in a. rep(sort(intersect(a, b)), pmin(table(a[a %in% b]), ta

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread David Winsemius
On May 20, 2010, at 7:10 PM, David Winsemius wrote: On May 20, 2010, at 6:24 PM, Jonathan wrote: Thanks, but that doesn't quite work, since I'd want the result of b[b %in% a] to be symmetric with a[a%in%b] (so if there are two 2's in EACH vector, I'll get two 2's in the result, but if there

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread David Winsemius
On May 20, 2010, at 7:30 PM, Nordlund, Dan (DSHS/RDA) wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Jonathan Sent: Thursday, May 20, 2010 3:25 PM To: David Winsemius Cc: r-help Subject: Re: [R] intersect() without

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Jonathan > Sent: Thursday, May 20, 2010 3:25 PM > To: David Winsemius > Cc: r-help > Subject: Re: [R] intersect() without discarding duplicates? > &g

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread David Winsemius
On May 20, 2010, at 6:24 PM, Jonathan wrote: > Thanks, but that doesn't quite work, since I'd want the result of > b[b %in% a] to be symmetric with a[a%in%b] (so if there are two 2's > in EACH vector, I'll get two 2's in the result, but if there are two > 2's in only one vector, but one two

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread Jonathan
Thanks, but that doesn't quite work, since I'd want the result of b[b %in% a] to be symmetric with a[a%in%b] (so if there are two 2's in EACH vector, I'll get two 2's in the result, but if there are two 2's in only one vector, but one two in the other, the result will show only one 2. Consider: >

Re: [R] intersect() without discarding duplicates?

2010-05-20 Thread David Winsemius
On May 20, 2010, at 5:58 PM, Jonathan wrote: Hi all, The ?intersect entry kindly points out that it discards duplicate entries. I'm looking, however, to get the intersection while KEEPING duplicate entries, and there are no instructions on how to accomplish this using intersect(). Does a

[R] intersect() without discarding duplicates?

2010-05-20 Thread Jonathan
Hi all, The ?intersect entry kindly points out that it discards duplicate entries. I'm looking, however, to get the intersection while KEEPING duplicate entries, and there are no instructions on how to accomplish this using intersect(). Does anybody have any idea how this might be done, or am

Re: [R] intersect

2010-05-11 Thread David Winsemius
On May 11, 2010, at 10:31 PM, Yuan Jian wrote: Hi there, how can I test every element in a vector whether appears in another vector? such as a<-c("aa", "bb", "ff", "cc") b <-c("oo","jj","bb","cc") somefunction(a,b) gives [False, True, False, True] The other answers probably gave you what

Re: [R] intersect

2010-05-11 Thread Sean Anderson
wrote: > how can I test every element in a vector whether appears in another vector? > such as > a<-c("aa", "bb", "ff", "cc") > b <-c("oo","jj","bb","cc") a %in% b [1] FALSE TRUE FALSE TRUE __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] intersect

2010-05-11 Thread Jorge Ivan Velez
Hi Yuan, Try > a<-c("aa", "bb", "ff", "cc") > b <-c("oo","jj","bb","cc") > a %in% b [1] FALSE TRUE FALSE TRUE HTH, Jorge On Tue, May 11, 2010 at 10:31 PM, Yuan Jian <> wrote: > Hi there, > > how can I test every element in a vector whether appears in another vector? > such as > a<-c("aa", "

[R] intersect

2010-05-11 Thread Yuan Jian
Hi there, how can I test every element in a vector whether appears in another vector? such as a<-c("aa", "bb", "ff", "cc") b <-c("oo","jj","bb","cc") somefunction(a,b) gives [False, True, False, True] thanks yuan jian [[alternative HTML version deleted]] _

Re: [R] Intersect, Union of date/time ranges

2010-03-17 Thread David Winsemius
On Mar 17, 2010, at 10:52 PM, Nathan S. Watson-Haigh wrote: I have 2 sets of data which defines the start and end of date/time periods. I want to be able to obtain the following: 1) The intersect of those 2 sets of date/time ranges i.e. return start/end date/time ranges where both sets ove

[R] Intersect, Union of date/time ranges

2010-03-17 Thread Nathan S. Watson-Haigh
I have 2 sets of data which defines the start and end of date/time periods. I want to be able to obtain the following: 1) The intersect of those 2 sets of date/time ranges i.e. return start/end date/time ranges where both sets overlap 2) The union of those 2 sets of date/time ranges i.e. return

Re: [R] intersect character

2007-11-14 Thread Peter Alspach
Kevin How about, for example, plot(1, xlab=quote(B~intersect(A))) Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Kevin J. Thompson > Sent: Thursday, 15 November 2007 5:51 a.m. > To: R-help > Subject: [R] i

[R] intersect character

2007-11-14 Thread Kevin J. Thompson
hello, can anyone help me concatenate a string containing the intersect character? i need to use it in a figure legend. thanks, kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide