
Repair attributes after idiomatic construction
Source:R/repair_attributes.R
dot-cstr_repair_attributes.RdExported for custom constructor design. In the general case an object might have more attributes than given by the idiomatic
construction. .cstr_repair_attributes() sets some of those attributes and ignores
others.
Usage
.cstr_repair_attributes(
x,
code,
...,
ignore = NULL,
idiomatic_class = NULL,
remove = NULL,
flag_s4 = TRUE,
repair_names = FALSE
)Arguments
- x
The object to construct
- code
The code constructing the object before attribute repair
- ...
Forwarded to
.construct_apply()when relevant- ignore
The attributes that shouldn't be repaired, i.e. we expect them to be set by the constructor already in
code- idiomatic_class
The class of the objects that the constructor produces, if
xis of classidiomatic_classthere is no need to repair the class.- remove
Attributes that should be removed, should rarely be useful.
- flag_s4
Boolean. Whether to use
asS4()on the code of S4 objects, set toFALSEwhen a constructor that produces S4 objects was used.- repair_names
Boolean. Whether to repair the
namesattribute. Generally it is generated by the constructor but it is needed for some corner cases