This web page provides a tutorial to create and host your own R
package. This is only for educational purpose. You are free to use it as
per LICENSE conditions.
Find the attached statools directory as source code. You
may download it and you can make changes in it. You are free to upload
it as your own package and host it on GitHub.
setwd("E:/statools")
DESCRIPTION and
add following lines (Make changes if needed)Package: statools
Type: Package
Title: Frequently used basic Statistics functions
Version: 0.0.1
Authors@R: person("Deepak", "Sharma", email = "Your_id@email.com", role = c("aut", "cre"))
Description: This package provides functions to perform operation such as
mode identification, standardization & normalization on R vectors
Depends: R (>= 3.1.0)
License: GNU General Public License v3.0
RoxygenNote: 7.2.1
Encoding: UTF-8
#' Provides mode for a distribution vector
#' @param dis_vec A distribution vector.
#' @return mode_dis_vec A distribution vector.
#' @examples
#' Provides a single value if there is only one mode
#'
#' modes(c(1,3,2,4,5,3)
#' modes(c(1,2,3))
#'
modes <- function(dis_vec) {
dis_vec_hist <- table(dis_vec)
mode_dis_vec <- as.numeric(names(dis_vec_hist)[dis_vec_hist == max(dis_vec_hist)])
return(mode_dis_vec)
}
# To call this function you need to have roxygen2 package in your R library
roxygenise()
man folder. For better documentation edit the R source
file. (Suggestion: Use VCS-SCM such as git)# You need to have devtools library installed to do so
library(devtools)
install_github("deep-bits/PFA/statools");
Welcome to the open-source world.
If you are using GitHub for some open-source softwares/library, then you can also contribute.