# NOT RUN {
# this is a valid (positive) example
kinship <- matrix(c(0.5, 0, 0, 0.6), nrow=2)
# this will run without errors or warnings
validate_kinship(kinship)
# negative examples
# dies if input is missing
try( validate_kinship() )
# and if input is not a matrix
try( validate_kinship( 1:5 ) )
# and for non-numeric matrices
char_mat <- matrix(c('a', 'b', 'c', 'd'), nrow=2)
try( validate_kinship( char_mat ) )
# and non-square matrices
non_kinship <- matrix(1:2, nrow=2)
try( validate_kinship( non_kinship ) )
# }
Run the code above in your browser using DataLab