简体   繁体   中英

Points of intersection in R

This might be a stupid question...

I've two vectors containing Y coords X is simply 1:8

I've added the lines to a plot area and would like to identify the point of intersection of the two lines.

Is there a default package to find this?

Thanks

The intersection of two lines is found analytically by solving the two linear equations which define the lines. I'll leave the math as an exercise to the OP.

If you want to use a very helpful and powerful package, you could read up on the package spatstat . Once you've converted your lines into psp objects, use spatstat:crossing.psp to find intersections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM