R/vectorIsConstant.r

Defines functions vectorIsConstant

########## R-function: vectorIsConstant ##########

# Determine whether or not a vector has all entries
# equal to a particular constant value.

# Last changed: 23 JUN 2021

vectorIsConstant <- function(x)
{
   if (length(x)==1) 
      return(TRUE)

   if (length(x)>1)
      return(!any(x[1]!=x[-1]))
}

########## End of vectorIsConstant ############

Try the gamselBayes package in your browser

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

gamselBayes documentation built on June 8, 2025, 10:21 a.m.