fig_density | R Documentation |
Plot a density of a score
fig_density(
df,
score,
var_color = NULL,
var_facet = NULL,
cutoffs = NULL,
x_lab = "Score",
pal = "Paired",
adjust = 2,
size = 1.5
)
df |
a data frame where each row is an individual, containing at least a score column (between 0 and 100) |
score |
a string (length 1) of the column name for the score variable to print the distribution of |
var_color |
a string (length 1) of the column name for the variable to set color of density lines by. Default is NULL. |
var_facet |
a string (length 1) of the column name for the variable to create a |
cutoffs |
a numeric vector of the cut-offs for the score categorization. Default is NULL. |
x_lab |
a string (length 1) of x-axis label. Default is "Score". |
pal |
a string specifying either a manual color to use for the color aesthetic, a character vector explictly specifying the colors to use for the color scale, or as the name of a palette to pass to |
adjust |
a numeric value to pass to |
size |
a numeric value to pass to |
Plots a histogram of a score that ranges between 0 and 100, with the fill determined by some set categorization of the score. This is the function used to plot the distributions of disability scores resulting from the WHO Model Disability Survey.
A density figure
Other figure functions:
fig_LID()
,
fig_dist()
,
fig_poppyramid()
fig_density(df_adults, score = "disability_score", cutoffs = c(19.1, 34.4, 49.6),
x_lab = "Disability score")
fig_density(df_adults, score = "disability_score", var_color = "sex",
cutoffs = c(19.1, 34.4, 49.6), x_lab = "Disability score")
fig_density(df_adults, score = "disability_score", var_color = "sex",
var_facet = "age_cat", cutoffs = c(19.1, 34.4, 49.6), x_lab = "Disability score")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.