zap_attr function

Remove Attributes to Get a Simplified Object

Remove Attributes to Get a Simplified Object

Get rid of summarytools-specific attributes to get a simple data structure (matrix, array, ...), which can be easily manipulated.

zap_attr(x, except = c("dim", "dimnames"))

Arguments

  • x: An object with attributes
  • except: Character. A vector of attribute names to preserve. By default, dim and dimnames are preserved.

Details

If the object contains grouped results:

  • The inner objects will lose their attributes
  • The stby class will be replaced with by
  • The dim and dimnames attributes will be set to available relevant values, but expect slight differences between objects created with stby() vs group_by().

Examples

data(tobacco) zap_attr(descr(tobacco)) zap_attr(freq(tobacco$gender))