Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.

File: utilities/geometry.r

View File Source Download File No help file available

Function: perpendicular.distance

Function Description: perpendicular.distance

Distance from a point to a line (so it's the perpendicular distance); m and b are slope and intercept; x and y are (vectors) of points. Note check for infinite slope, meaning that the intercept b is the x-intercept.

Function Arguments:

ArgumentDefault Value

Arguments Description:

b: y-intercept m: line slope

Function Source:

if(!is.infinite(m)) return(sqrt((y-m*x-b)^2/(1+m^2)))
else return(abs(x-b))