Displaying 20 results from an estimated 20000 matches similar to: "intersect() without discarding duplicates?"
2011 Oct 25
1
question regarding intersect function
Hi
I have probably a very simple question but I'm going crazy trying to find
the solution.
I have two data.frames with headers and I'm doing an intersection between
them by names, such that the intersected data.frames are returned by:
df1[intersect(names (df1), names(df2))] and the same for df2
Now, I want to have all the opposite data that did not intersect. I tried to
do:
2013 Sep 01
1
Intersect 2 lists+bring extra columns
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
<http://r.789695.n4.nabble.com/file/n4675136/example.csv> .
In my example, I have a reference list of fruit (first column), and my fruit
of
2008 Feb 20
2
intersecting rows of a matrix
useR's,
First, I would like to say thanks to John Fox for providing this segment of
code to perform intersection for multiple sets:
intersection <- function(x, y, ...){
if (missing(...)) intersect(x, y)
else intersect(x, intersection(y, ...))
}
I want to execute this function on the rows of a matrix I have:
Ik.mat.test <- matrix(c(2,3,6,1,2,6,6,1,2),byrow=T,nrow=3)
> Ik.mat.test
2009 Dec 02
3
documentation of intersect() on string vector and num vector and on duplicated elements
> intersect(c(1,3,2),c('1','3'))
[1] "1" "3"
Apparently, intersect() treats num as string. But this is not
documented in the help. Could somebody add it in the future version of
R?
Also according to the help, the argument should not have duplicated
elements. But I tried the following example, it seems that it doesn't
matter where there are duplicated
2012 Feb 02
3
How to get intersection of multiple vectors?
v1<-c("a","b","c","d")
v2<-c("a","b","e")
v3<-c("a","f","g")
I want to get the intersection of v1,v2,v3,ie "a"
How can I do then?
What I know is only for 2 vectors via "intersect" function,but don't know how to deal with multiple vectors.
Many thanks
2005 Sep 21
3
ts.intersect bug?
This code gives an error:
a <- ts(1:10, start=0, freq=10)
b <- ts(1:10, start=1, freq=10)
ts.intersect(a,b)
This one works normally (and correctly):
a <- ts(1:10, start=0)
b <- ts(1:10, start=1)
ts.intersect(a,b)
Antonio, Fabio Di Narzo.
P.S. How to switch off italian error messages to post on r-help?
> version
_
platform i386-pc-mingw32
arch i386
os
2008 May 28
1
Multiple Intersections
Hi all,
I don't know if this is the correct venue for this question, but I am sure
that someone will correct me if I am in the wrong list.
I have been searching throughout R for a function that can find the
intersection of multiple sets of "things". Say for instance, I have a list
of $n$ character vectors and would like to find the intersection of all $k$
subsets. I don't
2011 Feb 22
2
How to find points of intersection between harmonic function and a line
Hi,
Sorry for the very short explanation about the problem of intersection.
I have a wave function monitored from the heart beat in a particular interval of
times.?Apart?fom that, there is?a line with positive slope (e.g: y = x+2) which
lies across the wave and intersect on a number of points. My problem is i have
no exact equation for?such a?complex harmonic wave produced by the heart
2010 Aug 10
3
Intersecting list vs rows in matrix
Know that if I have List_1 and List_2 that I can check to see if the
intersect via the code below:
List _1:
a, b, c, d, e, f, g
List_2:
z, y, x, w, v, u, b
length(intersect(List_1, List_2)) > 0
return = true
If instead I wanted to check a dataframe that is a "list of lists," how
would I do that by record without looping?
List _1:
a, b, c, d, e, f, g
List_2:
z, y, x, w, v,
2007 Jun 15
1
A question about logical controls and function arguements
Dear R-help subscribers,
I'm trying to write a function to generate data simulating the image
created by a point radiation source in a plane on a screen where there
is filter with a single circular aperture in it between the source and
the screen.
Following some guides (including Intro to R and some I found online) and
examples I have specified the function (full code below question) with
2011 Jul 06
3
finding the intersection of two vectors
Hi,
Suppose I have two vectors, not necessarily the same length (in fact,
they usually are different lengths): y.1 that has increasing values
between 0 and 1; y.2 that has decreasing values between 1.0 and 0. You
can picture these as being supply (= y.1) and demand (= y.2) curves from
economics. I typically plot these vectors on the same graph against a
common x variable, which happens to
2011 Dec 22
1
Union/Intersect two continuous sets
Dear All,
It is my first time using this mail list to post a question. And I
sincerely hope that this will not bother any subscribers.
So far as I know, there are functions like union( ), which can help to
combine two sets of discrete data. But what if the data sets are with
continuous data. For instance, I got three sets like [2, 4], [5, 6], [3.4,
5.5]. I wonder if there is a quick solution to
2005 May 05
2
Intersection of more than two groups in one function?
Hi all,
As far as I can tell, the only canned way to do an intersect between two
vectors of ints is the intersect(vec1, vec2) function -- is there another
function I'm missing for intersecting more than two vectors??
TIA,
Ken
2007 Apr 24
5
intersect more than two sets
Hi,
I searched the archives and did not find a good solution to that.
assume I have 10 sets and I want to have the common character elements of them.
how could i do that?
--
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.
"Did you always know?"
"No, I did not. But I believed..."
---Matrix III
2009 Oct 08
2
intersection of 2 density curves
Hi,
I would like to find out the coordinates of the intersection points of 2 density curves. I did a search but i didn't get any significant results. I really hope some of you have some ideas. here it is an example:
set.seed(123)
x1 <- rnorm(100, 1, 1)
x2 <- rnorm(100, 0, 1)
d1 <- density(x1)
d2 <- density(x2)
plot(d1, col = 2)
lines(d2, col = 4)
Now i would like to know
2005 Jun 03
1
ts.intersect a multivariate and univariate ts
This seems like a FAQ, but I can't figure it out.
I have a mv ts object:
R > tsp(pg)
[1] 1982 2003 1
R > dim(pg)
[1] 22 12
and a univariate ts:
R > tsp(rw)
[1] 1690 1996 1
Yet, when I try to intersect them:
R > tsp(ts.intersect(rw, pg))
[1] 1982 2176 1
the process goes awry.
How to I get rw and pg to be one ts that runs from 1982 to 1996 and has 13
univariate time
2004 Jul 08
4
read.frame
Hello group,
I am learning R and I am new to many concepts.I face
the following errors when I am trying to execute the
following. I have 4 text files with protein accession
numbers. I wanted to represent them in a venn diagram
and for that I using intersect and setdiff functions.
My data looks like this:
file1.txt (c):
NP_000005
NP_000020
NP_000030
NP_000053
file2.txt(e):
NP_000005
NP_000020
2012 Jun 26
3
Intersection
Hello.
I have a problem with 2 dataframes. There are 2 columns - "value" and
"dates". These dataframes have different dimension. Some dates coincide.
And I need to intersect them by dates and have on output two dataframes
with identical columns "dates" and new dimension . "value" have to
recieve in compliance with dates.
Regards, Aleksander.
[[alternative
2007 Mar 29
0
(PR#9589) 'union' does not handle factors while 'intersect'
This is not a bug, nor is the subject line true: both do accept
factors but what they do with factors is undocumented. From the help
(not 'man') page
Performs *set* union, intersection, (asymmetric!) difference,
equality and membership on two vectors.
^^^^^^^
so it is not said to work on factors. I disagree that what intersect()
for
2012 Jun 06
3
problem about set operation and computation after split
hi,
I met some problems in R, plz help me.
1. How to do a intersect operation among several groups in one list, without
a loop statement? (I think It may be a list)
create data:
myData <- data.frame(product = c(1,2,3,1,2,3,1,2,2),
year=c(2009,2009,2009,2010,2010,2010,2011,2011,2011),value=c(1104,608,606,1504,508,1312,900,1100,800))
mySplit<- split(myData,myData$year)