Added isfield translation function
This commit is contained in:
parent
62598eaf0d
commit
317d281e70
2 changed files with 29 additions and 0 deletions
9
R/isfield.R
Normal file
9
R/isfield.R
Normal 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)
|
||||||
|
}
|
||||||
20
man/isfield.Rd
Normal file
20
man/isfield.Rd
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/isfield.R
|
||||||
|
\name{isfield}
|
||||||
|
\alias{isfield}
|
||||||
|
\title{Checks if a list contains a field}
|
||||||
|
\usage{
|
||||||
|
isfield(x, field)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{x}{list}
|
||||||
|
|
||||||
|
\item{field}{name of field}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
This function tries to replicate the behavior of the `isfield`
|
||||||
|
function in Matlab
|
||||||
|
}
|
||||||
|
\references{
|
||||||
|
https://se.mathworks.com/help/matlab/ref/isfield.html
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue