sclass: return the classes of a list of objects

sclassR Documentation

return the classes of a list of objects

Description

return the classes of a list of objects

Usage

sclass(x, ...)

Arguments

x

an S3 object inheriting from class list, or an S4 object.

...

additional parameters are ignored.

Details

This function takes a list and returns the classes for each object in the list. In the event an object class has multiple values, the returned object is a list, otherwise is a vector. If x is an S4 object, then slotNames(x) is used, and the class is returned for each S4 slot.

When x is a data.frame, data.table, tibble, or similar DataFrame table-like object, the class of each column is returned.

For the special case where x is an S4 object with one slotName ".Data", the values in x@.Data are coerced to a list. One example of this case is with limma::MArrayLM-class.

When x is a matrix, the class of each column is returned for consistency, even though the class of each column should be identical.

For more more information about a list-like object, including the lengths/dimensions of the elements, see sdim() or ssdim().

Value

character vector with the class of each list element, or column name, depending upon the input class(x).

See Also

Other jam practical functions: breakDensity(), checkLightMode(), check_pkg_installed(), colNum2excelName(), color_dither(), diff_functions(), exp2signed(), fileInfo(), fixYellow(), getAxisLabel(), handleArgsText(), heads(), isFALSEV(), isTRUEV(), jamba, jargs(), kable_coloring(), lldf(), log2signed(), make_html_styles(), make_styles(), match_unique(), mergeAllXY(), middle(), minorLogTicks(), newestFile(), printDebug(), renameColumn(), rmInfinite(), rmNAs(), rmNA(), rmNULL(), sdim(), setPrompt()

Other jam list functions: cPasteSU(), cPasteS(), cPasteUnique(), cPasteU(), cPaste(), heads(), jam_rapply(), list2df(), mergeAllXY(), mixedSorts(), rbindList(), relist_named(), rlengths(), sdim(), uniques(), unnestList()

Examples

sclass(list(LETTERS=LETTERS, letters=letters));

sclass(data.frame(B=letters[1:10], C=2:11))


jmw86069/jamba documentation built on Oct. 9, 2024, 10:52 a.m.