2020-03-03 10:50:27 +01:00
|
|
|
#' @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
|
2020-03-03 11:04:40 +01:00
|
|
|
#' @export
|
2020-03-03 10:50:27 +01:00
|
|
|
isfield <- function(x, field) {
|
2021-11-10 14:02:35 +01:00
|
|
|
sapply(field, function(f) f %in% names(x))
|
|
|
|
|
}
|