clgen: write the code for an S4 class with setters and getters

Description Usage Arguments Note Examples

View source: R/clgen.R

Description

write the code for an S4 class with setters and getters

Usage

1
2
3
4
5
6
clgen(
  clname = "Turtle",
  protolist = list(location = c(0, 0), orientation = 0, path = matrix(c(0, 0), ncol =
    2)),
  check_init = FALSE
)

Arguments

clname

character(1) class name

protolist

named list() of prototypical values for slots

check_init

logical(1) if TRUE, try to construct instance with prototype before building code

Note

The example is inspired by Stuart Lee's blog post

Examples

1
2
3
dm = clgen()
dm
dumpcs(dm)

vjcitn/DrS4 documentation built on Oct. 4, 2021, 10:13 p.m.