Displaying 20 results from an estimated 1203 matches for "intersection".
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
[,1] [,2] [,...
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
[[alternative HTML version deleted]]
2007 Jun 15
1
A question about logical controls and function arguements
...art Point
if (source.p=="r")
{source<-c(rnorm(1,source.mean,source.sd),rnorm(1,source.mean,source.sd))}
else {source<-source.p}
cat("The location of the source is: ",source,"\n")
##Generate the data
remainder<-num.points
initial.sample<-c(1,1)
##finds intersection points with the screen
intersect.screen.at<-function(x,h){
t<-h[1]/(2*cos(x))
x.intercept<-t*sin(x[,2])*cos(x[,1])
y.intercept<-t*sin(x[,2])*sin(x[,1])
}
##finds intersection points with the collecting plate
intersect.plate.at<-function(x,h){
t<-h[2]/(2*cos(x))...
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 believe that there is such a function to do this (or am I
wrong?). It is a pretty easy to encode such a function...there was an e-...
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
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
2008 Oct 03
1
Point of intersection
...length=100)
plot(x,p1,type='n',ylab="Density",main="Overlap Measure",xaxt="n",yaxt="n")
pi=dnorm(x,0,1)
points(x,p1,type='l')
abline(0.07,0.01)
you can see that the curves intersects at 3 points. My question is how do I
mark the point of the intersection? I like to mark it as (x1,y1) as the
first point of intersection and so on. or I can just mark the x-coordinate
of the 1st intersection as x1 on the x-axis.
Thanks,
lavan
--
View this message in context: http://www.nabble.com/Point-of-intersection-tp19791632p19791632.html
Sent from the R help m...
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: df1[-intersect(names (df1), names(df2))] and some other stuff but it
didn&...
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 p...
2013 Sep 01
1
Intersect 2 lists+bring extra columns
...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 interest (second column), and then in the third column, I have color
information about the fruit of interest in the second column.
Currently to find the intersection between column 1 and 2, I use
>fruit<-read.csv("//Users//J//Desktop//example.csv", header=TRUE)
>output<-intersect(fruit[,1],fruit[,2])
>write.table(data.frame(fruit),"output.xls", col.names=TRUE,
row.names=FALSE)
However, it would save me a lot of time if I cou...
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
2004 Jul 08
4
read.frame
...ot;y" is
missing, with no default
> CiS<-intersect(read.frame(c,s))
Error in unique(y[match(x, y, 0)]) : Argument "y" is
missing, with no default
##### Why am I getting this error.
Second thing I did:
I loaded the data as data.frame instead read.table().
Again I never get intersection of C,E and S,H.
Can any one please help me.
thank you
SP
2010 May 06
3
Intersection list
How can I create intersections of vectors?
a <- c(1,2,3)
b <- c(1,5,6)
the intersected list c should contain c(1)...
Ralf
2009 Oct 14
2
Getting indeices of intersecting elements.
Hi,
Is there a command to get the indices of intersecting elements of two
vectors as intersect() will give the elements and not its indices.
Thanks in advance.
Praveen Surendran
School of Medicine and Medical Sciences
University College Dublin
Belfield, Dublin 4
Ireland.
[[alternative HTML version deleted]]
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 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
2005 Dec 29
1
use of tapply?
I'm still learning how to program with R and I was hoping someone could
take the time to show me how I can rewrite this code?
Many thanks
Tom
data.intersects<-data.frame(
x=c(0.230,0.411,0.477,0.241,0.552,0.230),
y=c(0.119,0.515,0.261,0.431,0.304,0.389),
angle=vector(length=6),
length=vector(length=6),
2010 May 20
1
intersect() without discarding duplicates?
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 I going to need to
program something from scratch (something like ordering the vectors and then
looping through them)?
ex:
> a...
2012 Mar 04
1
Intersection of two chromosomal ranges
Hi,
I want to merge multiple chromosomal regions based on their common
intersecting regions. I tried couple of things using while and if loops but
did not work out.
I would appreciate if anyone could provide me a small piece of code in R to
get the intersection of following example:
chr1: 100-150
chr1: 79-250
chr1: 100-175
chr1: 300-350
I want the intersection of all four regions as follow:
chr1: 100-150
chr1: 300-350
I have thousands of these regions (some overlap and some not).
Regards,
--Yadav
[[alternative HTML version deleted]]
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...