R/hello.R

Defines functions plus_one absolute_value1

Documented in absolute_value1 plus_one

# Hello, world!
#
# This is an example function named 'hello'
# which prints 'Hello, world!'.
#
# You can learn more about package authoring with RStudio at:
#
#   http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
#   Install Package:           'Ctrl + Shift + B'
#   Check Package:             'Ctrl + Shift + E'
#   Test Package:              'Ctrl + Shift + T'



#' plus_one()
#'
#'This function adds the number 1 to any number. This function works with negative as well as positive values. The edge cases work for this function.
#' @param x
#'The parameter x accepted by this function is an integer or numeric data type argument.
#' @return
#' The function returns an integer value. The returned value is the number incremented by 1.
#' @export
#'
#' @examples
#' plus_one(2)
plus_one <- function(x) {

  x+1

}

#' absolute_value1()
#'
#'This function returns the absolute value of any number passed to it plus the number 1.
#' @param x
#'The parameter x accepted should be of integer or numeric type.
#' @return
#' The returned variable x should also be of integer type and is the absolute value of the number incremented by 1.
#' @export
#'
#' @examples
#'absolute_value1(-1)
absolute_value1 <- function(x) {

  abs(x)+1

}
hariniramp/DATA-598-WI20-week7 documentation built on March 7, 2020, 11:22 p.m.