Learn R Programming

PopED (version 0.3.2)

isfield: Function written to match MATLAB's isfield function

Description

Check if a list or dataframe has an element with a specific name.

Usage

isfield(obj, sub.obj.str)

Arguments

obj

A list or dataframe

sub.obj.str

A string giving the name of the sub-object you want to check for.

Value

Logical. True if the element exists.

See Also

Other MATLAB: cell, diag_matlab, feval, fileparts, isempty, ones, randn, randperm, rand, size, tic, toc, zeros

Examples

Run this code
# NOT RUN {
foo <- list("fff"=8,"ggg"=9)

isfield(foo,"fff")
isfield(foo,"lll")
# }

Run the code above in your browser using DataLab