#' Compute slope and intercept of line passing through two points on 2D plane
#'
#' @param point1_coord A vector of point 1 coordinate, where point1_coord[1] is the X-axis coordinate while point1_coord[2] is the Y-axis coordinate.
#' @param point2_coord A vector of point 2 coordinate, where point1_coord[1] is the X-axis coordinate while point1_coord[2] is the Y-axis coordinate.
#' @export
compute_SlopeAndIntercept_givenTwoPoints <- function(point1_coord=c(0,0),point2_coord=c(1,1)){
m <- (point1_coord[2]-point2_coord[2])/(point1_coord[1]-point2_coord[1])
int <- point1_coord[2]-m*point1_coord[1]
return(c(slope=m,intercept=int))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.