Learn R Programming

matlab2r (version 1.5.0)

isfield: Checks if a list contains a field

Description

This function tries to replicate the behavior of the isfield function in Matlab

Usage

isfield(x, field)

Value

A logical vector determining if field is within names(x)

Arguments

x

list

field

name of field

References

https://se.mathworks.com/help/matlab/ref/isfield.html

Examples

Run this code
S <- list(
  x = rnorm(100),
  title = "x"
)
isfield(S, "title")
isfield(S, "z")

Run the code above in your browser using DataLab