points2equation: Get a Slope–intercept Form from a Two-point Form of an...

View source: R/points2equation.R

points2equationR Documentation

Get a Slope–intercept Form from a Two-point Form of an Equation

Description

Two-point from is often seen in German national forest inventory data, we want to get an equation of form y = a + bx.

Usage

points2equation(p1, p2 = c(0, 0))

Arguments

p1

The first point (x, y).

p2

The second point (x, y).

Value

A named vector with intercept ["a"] and slope ["b"]. If both points have the same value for x, no function exists. Then the intercept is NA and the slope gives the value of x.

See Also

Other geometry functions: get_intersection(), vector_length()

Examples

points2equation(c(0, 4), c(1, 5))

treePlotArea documentation built on June 22, 2024, 6:57 p.m.