get_line: Calculate Slope-Intercept Form of a Line

View source: R/get_line.R

get_lineR Documentation

Calculate Slope-Intercept Form of a Line

Description

Given two points, calculates the slope-intercept form of a line.

Usage

get_line(p1, p2)

Arguments

p1

The coordinates of the first point, specified as a numeric vector of length 2.

p2

The coordinates of the second point, specified as a numeric vector of length 2.

Value

A named numeric vector containing the intercept and slope of the line.

Examples

p1 <- c(0, 0)
p2 <- c(1, 1)
get_line(p1, p2)
# Output: intercept = 0, slope = 1

mobilizingcs/mobilizr documentation built on May 5, 2024, 1:01 a.m.