View source: R/rbitr_helpers.R
add_x_intercepts | R Documentation |
Given a data frame of x-y coordinates, find the x-intercepts of the line segments that connect neighboring pairs of points, and add the x-intercepts to the data frame.
add_x_intercepts(dataframe, x_name, y_name)
dataframe |
A 2-column data frame with numeric columns, where each row is a point in the x-y plane. |
x_name |
A single-element character vector with the name of the column containing the x-coordinates. |
y_name |
A single-element character vector with the name of the column containing the y-coordinates. |
The input data frame is expected to have two columns, with each row
being the Cartesian coordinates of a point in the x-y plane. If the points
are arranged in order of increasing x values and connected by line
segments, add_x_intercepts
will find the points where the segments
intersect the x-axis and add those points to the data frame.
A new data frame consisting of the original data frame with new rows added for each intersection with the x-axis.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.