#' Euclidian Distance
#' Finds Euclidian Distance between two numeric scalers or integers.
#' @param A a numeric scaler or integer.
#' @param B a numeric scaler or integer.
#' @return The Euclidian Distance between \code{A} and \code{B}.
#' @examples
#' euclidean(123612, 13892347912)
#' @export
euclidean <- function(A,B){
# Checking if arguments are numeric scalers
stopifnot(is.numeric(A) & is.numeric(B))
# Making sure we have absolute values
A = abs(A)
B = abs(B)
while (A != B ){ # Repeat untill A and B are not equal
temp <- B # Storing B to temp variable
B <- A %% B
if(is.na(B)){ break} else{A <- temp}
}
return(A)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.