create a function to check if a point falls between two lines in r

Maybe you can manage it easily with function. The idea is to test if the point(s) are in the polygon made by your coordinates.

# first you've to get one column for the long, and one column for the lat
new_df <- data.frame(long = c(long_1,long_2), lat = c(lat_1, lat_2))

# then you can put the points to test in a vector, like these, and use the function,-84.2),c(18.7,18.5),new_df$long,new_df$lat)
[1] 1 0   

One is in, one is out.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top