get_line | R Documentation |
Given two points, calculates the slope-intercept form of a line.
get_line(p1, p2)
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. |
A named numeric vector containing the intercept and slope of the line.
p1 <- c(0, 0)
p2 <- c(1, 1)
get_line(p1, p2)
# Output: intercept = 0, slope = 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.