R/counta.R

Defines functions counta

Documented in counta

#'Simple count including zero###
#'@details This function counts how many the assigned elements there are in one vector.
#'@param z a vector you would like to check
#'@param y  an element you would like to count.(Even it is not included in z)
#'@return the times that y appears in z
#'@export
#'@examples
#'z <-rbinom(20,1,0.5)
#'counta(z,0)
#'


counta <- function(z,y){
  return(sum(z==y,na.rm = TRUE))
}

Try the mixIndependR package in your browser

Any scripts or data that you put into this service are public.

mixIndependR documentation built on March 17, 2021, 5:09 p.m.