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)
}
lxiao5/face documentation built on July 23, 2022, 6:24 p.m.