R/check.data.R

Defines functions check.data

Documented in check.data

check.data <-
function(data,type="fit"){
  if(type=="fit") {
    if(!is.data.frame(data)|is.null(data$y)|is.null(data$subj)|is.null(data$argvals))
      stop("'data' should be a data frame with three variables:argvals,subj and y")
    
    if(sum(is.na(data))>0) stop("No NA values are allowed in the data")
  
  }
  
  if(type=="predict"){
    if(!is.data.frame(data)|is.null(data$y)|is.null(data$subj)|is.null(data$argvals))
      stop("'newdata' should be a data frame with three variables:argvals,subj and y") 
  }
  return(0)
}

Try the mfaces package in your browser

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

mfaces documentation built on July 19, 2022, 9:05 a.m.