Skip to contents

Field names of a struct or an instance

Usage

fields(x)

Arguments

x

A struct, an instance, an S7 class or object, or anything as_type() accepts.

Value

A character vector, in declaration order.

Examples

Pt <- struct("Pt", x = num[1], y = num[1])
fields(Pt)
#> [1] "x" "y"
fields(Pt(x = 1, y = 2))
#> [1] "x" "y"