R/test.segmented.R

Defines functions test.segmented

test.segmented <- function(X){
  # How many identical values is needed before the function
  # return TRUE
  threshold.fraction = 0.33 
  threshold = floor(threshold.fraction*nrow(X)*ncol(X)) 

  # Number of identical values in the same column in adjacent rows 
  identicals = (X[1:(nrow(X)-1),] == X[2:nrow(X),])

  return(sum(identicals,na.rm=TRUE) > threshold)
}

Try the pint package in your browser

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

pint documentation built on Oct. 31, 2019, 2:41 a.m.