This is useful for DTA export since Stata has a built-in variable name length limit of 32 characters (see also here).
Arguments
- x
A tabular data object like a data frame or tibble.
- max_n_char
Maximum allowed number of characters. It is ensured that the maximum resulting variable name length doesn't exceed this limit. Has no influence on the applied shortening logic. An integerish scalar or
Inf
for no limit.
See also
Other variable name shortening functions:
restore_colnames()
,
shorten_var_names()