TABLE OF CONTENTS
methodsBiv/checkinput.bivrec [ Functions ]
NAME
checkinput.bivrec --- rudimentary input checking
FUNCTION
Does a few very basic checks on the input
SYNOPSIS
488 checkinput.bivrec <- function(agdata, clusternames, subjnames, stratnames, processnames)
SOURCE
491 { 492 # Check that start - stop times match 493 starttimes <- agdata$start[agdata$start > 0] 494 stoptimes <- agdata$stop[which(agdata$start > 0) - 1] 495 if(!isTRUE(all.equal(starttimes, stoptimes))) 496 stop("Interval start times must be equal to the preceding stop times") 497 498 # Check that there are events for each cluster 499 nclustevents1 <- table(agdata$i, agdata$delta) 500 nclustevents2 <- table(agdata$i, agdata$Delta) 501 if(!all(nclustevents1[, 2] > 0)){ 502 badclust <- which(nclustevents1[, 2] <= 0)[1] 503 stop(paste("Cluster", clusternames[badclust], "has no events of type", processnames[1])) 504 } 505 if(!all(nclustevents2[, 2] > 0)){ 506 badclust <- which(nclustevents2[, 2] <= 0)[1] 507 stop(paste("Cluster", clusternames[badclust], "has no events of type", processnames[2])) 508 } 509 # Check for missing values or NaN 510 if(any(sapply(agdata, is.infinite))) 511 stop("Infinite values in data") 512 }