Added isfield translation function

This commit is contained in:
Waldir Leoncio 2020-03-03 10:50:27 +01:00
parent 62598eaf0d
commit 317d281e70
2 changed files with 29 additions and 0 deletions

9
R/isfield.R Normal file
View file

@ -0,0 +1,9 @@
#' @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
isfield <- function(x, field) {
field %in% names(x)
}