On Fri, Apr 27, 2012 at 02:08:09PM -0700, Hans Thompson wrote: > I meant (1,1) as an (x,y) coordinate. I am trying to find the function to > return the coefficient of the line running through: > > >B > x y > a 1 1 > > and all the points in: > > >A > x y > a 1 3 > b 2 2 > c 3 1
Hi. If you want three coefficients, one for each point in A, then try C <- sweep(A, 2, B) C[, 2]/C[, 1] [1] Inf 1 0 Petr Savicky. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.