Questions tagged [intersect]

The SQL intersect operator returns rows that are common between two tables without returning duplicate records.

643 questions
5
votes
2 answers

How to find lines containing any string from another file?

I have 2 csv files. File A, with multiple columns. File B, with one column. eg.: File A: chr1 100000 100022 A C GeneX chr2 200000 200033 X GeneY chr3 300000 300055 G A GeneZ File B: GeneY GeneZ I would want my output to be: chr2 200000 200033 X…
Chris Dias
  • 67
  • 1
  • 7
5
votes
1 answer

What is the best way to subtract one list of objects from another in Groovy?

Is there a groovier way to subtract one list from another when the elements are objects? I thought there might be a way to use minus but can't figure it out. This is what I have: class item1 { int foo int getFoo(){return foo} public…
AndyJ
  • 1,204
  • 3
  • 14
  • 28
5
votes
1 answer

Collection priority in LINQ Intersect, Union, using IEqualityComparer

If I have two collections of type T, and an IEqualityComparer that compares a subset of their properties, which collection would the resulting elements of an Intersect or Union come from? The tests I've run so far suggest the following: the item(s)…
trilson86
  • 939
  • 1
  • 9
  • 20
5
votes
2 answers

Finding intersection of dataframe rownames

I have two dataframes. The row names in both are dates. What I want to do is, I want to select all the common rows (having same dates) in both the data frames and create a new data frame having only these common rows. Of course the individual…
user2127116
  • 61
  • 1
  • 3
4
votes
5 answers

in linq why are subsequent calls of IEnumerable.Intersect so much faster

while looking at this question C# Similarities of two arrays it was noted that the initial linq call was significantly slower than subsequent calls. What is being cached that is making such a difference? I am interested in when we can expect to…
dice
  • 2,820
  • 1
  • 23
  • 34
4
votes
6 answers

SQL subqueries alternative to INTERSECT

I have two tables: P and PC (master/detail joined by the column Id) Table P: Id integer Name varchar(12) Table PC: Id integer Code varchar(12) Val number I want to get all Names from P that satisfy the following simultaneous conditions: have a…
user1165334
  • 43
  • 1
  • 3
4
votes
2 answers

How to find out if two PolyLines intersect

I have a problem finding out if two PolyLines intersect. Well the main objective is to compare last X and Y with the other PolyLine and find out if it's colliding aka intersecting with it. There are gaps in the data due moving the X and Y, so most…
Rumplin
  • 2,703
  • 21
  • 45
4
votes
1 answer

Linq Contains value in list

its hard for me to explain this one, but i hope some code will help: var softChannels = channels.ByPath("/software/").Children.Where(c => c.StateProperties.IsActive); var tmpGames = new List(); //…
Rafael Herscovici
  • 16,558
  • 19
  • 65
  • 93
4
votes
3 answers

Intersect method in LINQ with C#

I am trying to obtain the same files using Intersect method from two folders. 123.xml files are the same (no change with content, date, size) in all the…
superstar
  • 1,832
  • 3
  • 17
  • 26
4
votes
1 answer

SQL UNION vs OR, INTERSECT vs AND

I would like to know what the difference between an INTERSECT and an AND statement as well as a UNION statement and a OR statement is. Is there a specific scenario where either one is recommended to use and can could I always use a OR/AND instead…
4
votes
1 answer

Queryable.Intersect() with SQLite and Linq not giving expected results

I want to search a database of books by several keywords. The more keywords I provide the narrower the search is to be. Here is my code: var words = text.Split(' '); IQueryable query = null; foreach (string word in words) { var…
B_old
  • 1,141
  • 3
  • 12
  • 26
4
votes
0 answers

Cannot open the connection in raster R

I used these functions several times, and they were working perfect, nothing wrong with my input data!! m<-raster::intersect(raster,shapefile) or n<-crop(raster, extent(shapefile)) I have to do this operation for a large set of data. Therefore, I…
4
votes
2 answers

Remove elements in a list in R

I want to remove part of the list where it is a complete set of the other part of the list. For example, B intersect A and E intersect C, therefore B and E should be removed. MyList <- list(A=c(1,2,3,4,5), B=c(3,4,5), C=c(6,7,8,9),…
Marcelo
  • 51
  • 9
4
votes
2 answers

Getting the intersection of two active record relations, rails

In this rails app, I have a method called by a controller that takes an active record relation of sites and an array of filters, the method returns any sites in the relation that have all of the filters in the array. Here is the method: def…
Phil Brockwell
  • 456
  • 5
  • 22
4
votes
3 answers

Rectangle intersection in Ruby

I'm trying to understand this program, but I'm having some difficulty. I don't understand the part with x_min, y_min, x_max, y_max. I understand the program passes through two rectangles with the bottom-left and top-right coordinate points, but…
ceckenrode
  • 4,543
  • 7
  • 28
  • 48