R/create1.R

Defines functions create1

Documented in create1

#' creates vector of 1's to be used in the estimators
#' @param y sample matrix
#' @return vector of 1's with size equal to the number of observations in the sample
#'
create1 <- function(y){
  if(is.vector(y)){
    vect1 <- rep(1,length(y))
  }
  else if(is.list(y)){
    vect1 <- rep(1,dim(y)[1])
  }
  else if(is.matrix(y)){
    vect1 <- rep(1,length(y[,1]))
  }
  else {
    stop("incorrect number of dimensions")
  }
  return(vect1)
  }

Try the BayesSampling package in your browser

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

BayesSampling documentation built on May 2, 2021, 1:06 a.m.