ourMELONS/R/isfield.R
Waldir Leoncio fca9caa731 Restyled files
Ran through styler::style_dir() in the R and tests directories in preparation for #23.
2021-11-10 14:25:50 +01:00

10 lines
351 B
R

#' @title Checks if a list contains a field
#' @description This function tries to replicate the behavior of the `isfield`
#' function in Matlab
#' @param x list
#' @param field name of field
#' @references https://se.mathworks.com/help/matlab/ref/isfield.html
#' @export
isfield <- function(x, field) {
sapply(field, function(f) f %in% names(x))
}