fig_dist | R Documentation |
Plot a distribution of a score
fig_dist(
df,
score,
score_cat,
cutoffs,
x_lab = "Score",
y_max = NULL,
pcent = FALSE,
pal = "Blues",
binwidth = 5
)
df |
a data frame where each row is an individual, containing at least a score column (between 0 and 100) and a categorization of that score |
score |
a string (length 1) of the column name for the score variable to print the distribution of |
score_cat |
a string (length 1) of the column name for the categorization of the score variable |
cutoffs |
a numeric vector of the cut-offs for the score categorization |
x_lab |
a string (length 1) of x-axis label. Default is "Score". |
y_max |
a numeric value of the maximum limit on the y-axis. Default is NULL to use default value from |
pcent |
a logical value determining whether or not to display the distribution as percentages or frequency. Default is FALSE, to display as frequency. |
pal |
a string to pass to |
binwidth |
a numeric value giving the width of the bins in the histograph. Default is 5. |
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 score distribution figure with fill based on categorization of the score
Other figure functions:
fig_LID()
,
fig_density()
,
fig_poppyramid()
fig_dist(df_adults, score = "disability_score", score_cat = "disability_cat",
cutoffs = c(19.1, 34.4, 49.6), x_lab = "Disability score")
fig_dist(df_adults, score = "disability_score", score_cat = "disability_cat",
cutoffs = c(19.1, 34.4, 49.6), x_lab = "Disability score", y_max = 2000)
fig_dist(df_adults, score = "disability_score", score_cat = "disability_cat",
cutoffs = c(19.1, 34.4, 49.6), x_lab = "Disability score", y_max = 0.2, pcent=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.