Learn R Programming

healthcareai (version 1.2.4)

distancePointLine: Compute the distance of a point from a line

Description

compute the distance of a point from a line given the x, y axes of the point and the slope and intercept of the line.

Usage

distancePointLine(x, y, slope, intercept)

Arguments

x

A numeric vector, x axis of the points

y

A numeric vector, y axis of the points

slope

A number, the slope of the line

intercept

A number, the intercept of the line

Value

A numeric vector, the length of the pointS from the line.

References

http://healthcare.ai

This helper funtion is originally found here http://paulbourke.net/geometry/pointlineplane/pointline.r

https://github.com/bryanhanson/ChemoSpecMarkeR/blob/master/R/findElbow.R

See Also

healthcareai

Examples

Run this code
# NOT RUN {
distancePointLine(c(2,0),c(3,2),-0.5,2.5)
# }

Run the code above in your browser using DataLab