Learn R Programming

fplot (version 1.2.0)

setFplot_dict: Sets/gets the dictionary used in fplot

Description

Sets/gets the default dictionary used to rename the axes/moderator variables in the functions of the package fplot. The dictionaries are used to relabel variables (usually towards a fancier, more explicit formatting) that can be useful not to explicitly use the arguments xlab/ylab when exporting graphs. By setting the dictionary with setFplot_dict, you can avoid providing the argument dict in fplot functions.

Usage

setFplot_dict(dict = NULL, ..., reset = FALSE)

getFplot_dict

Value

The function setFplot_dict() does not return anything, it only sets an option after checking the format of the arguments.

The function getFplot_dict() returns a named vector representing the dictionary set in setFplot_dict().

Format

An object of class function of length 1.

Arguments

dict

A named character vector or a character scalar. E.g. to change my variable named "a" and "b" to (resp.) "$log(a)$" and "$bonus^3$", then use dict = c(a="$log(a)$", b3="$bonus^3$").

...

You can add arguments of the form: variable_name = "Definition". This is an alternative to using a named vector in the argument dict.

reset

Logical, default is FALSE. If TRUE, then the dictionary is reset. Note that the default dictionary always relabels the variable "(Intercept)" in to "Constant". To overwrite it, you need to add "(Intercept)" explicitly in your dictionary.

Author

Laurent Berge

Details

By default the dictionary only grows. This means that successive calls with not erase the previous definitions unless the argument reset has been set to TRUE.

The default dictionary is equivalent to having setFplot_dict("(Intercept)" = "Constant"). To change this default, you need to provide a new definition to "(Intercept)" explicitly.

This dictionary is shared with the fixest package.

Examples

Run this code

data(airquality)
setFplot_dict(c(Ozone = "Ozone (ppb)"))
plot_distr(Ozone ~ Month, airquality, weight.fun = mean)

Run the code above in your browser using DataLab