#' Sum Product
#'
#' @param x : a numeric vector.
#' @param y : a numeric vector.
#'
#' @return a numeric vector of length 1
#' @export
#'
#' @examples
#' sum_product(1:5,6:10)
sum_product <- function(x,y){
if(length(x)!=length(y)){
stop("Length of x and y must be the same.")
}else if(length(x)<1){
stop("Length of x and y must be greater than 0.")
}else if(!(is.numeric(x)==T & is.numeric(y)==T)){
stop("x and y must be numeric.")
}else{
return(sum(x*y))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.