Skip to contents

Transforms numeric type attributes of dimensions into character type. In a star_schema numerical data are measurements that are situated in the facts. Numerical data in dimensions are usually codes, day, week, month or year numbers. There are tools that consider any numerical data to be a measurement, for this reason it is appropriate to transform the numerical data of dimensions into character data.


character_dimensions(st, length_integers = list(), NA_replacement_value = NULL)

# S3 method for star_schema
character_dimensions(st, length_integers = list(), NA_replacement_value = NULL)



A star_schema object.


A list of pairs name = length, for each attribute name its length.


A string, value to replace NA values.


A star_schema object.


It allows indicating the amplitude for some fields, filling with zeros on the left. This is useful to make the alphabetical order of the result correspond to the numerical order.

It also allows indicating the literal to be used in case the numerical value is not defined.

If a role playing dimension has been defined, the transformation is performed on it.

See also

Other star schema and constellation definition functions: constellation(), role_playing_dimension(), snake_case(), star_schema()


st <- star_schema(mrs_age_test, dm_mrs_age) |>
    dim_names = c("when", "when_available"),
    name = "When Common",
    attributes = c("date", "week", "year")
  ) |>
  character_dimensions(length_integers = list(week = 2),
                       NA_replacement_value = "Unknown")