Stop if a data.frame does not have some columns.
check.for.columns <- function
### Stop if a data.frame does not have some columns.
(d,
### data.frame to check.
must.have
### column names to check.
){
stopifnot(is.character(must.have))
for(N in must.have){
if(! N %in% names(d)){
stop("data must have a column named ",N)
}
}
}
| Please contact Toby Dylan Hocking if you are using directlabels or have ideas to contribute, thanks! |
| Documentation website generated from source code version 2021.2.24 (git revision bb6db07 Mon, 14 Jun 2021 22:38:45 +0530) using inlinedocs. |
| validate |