search for: intersect

Displaying 20 results from an estimated 1197 matches for "intersect".

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...
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 th...
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
...ne y=0.01x+0.07. the following code generate the plots. x=seq(-10,10,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....
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 di...
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 wav...
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 colum...
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 mingw32 system...
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 NP_000030 NP_000031 NP_000053 NP_000055 NP_000087 file3.txt(h): NP_000005 NP_000020 NP_000030 NP_000053 NP_000055 NP_000057 NP_000087 file4.txt (s): NP_00000...
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 Lis...
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), row.names=c('tbr','trg','dbr','dbg','pbr','pbg')) calcDist<-function(x,y...
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 pro...
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 re...
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,...