freq_bar: Function to get proportions and percentages of a single...

View source: R/freq_bar.R

freq_barR Documentation

Function to get proportions and percentages of a single variable

Description

This function is to examine normality and linearity of a linear regression in the form of histograms of your predictor and your outcome as well as a scatterplot of these variables.

Usage

freq_bar(data, x, fill, total)

Arguments

data

The data frame that includes the factor variable you are interested in getting proportions, percentages, and a visual of groups in the variable.

x

The X variable you'd like to examine.

fill

Value to determine the color you'd like your bar graph to be filled with. The outline of the histograms is set to "White"

total

Numerical value of your total sample in your study.

Value

Returns a list with a visual of the groups and a table of the proportions and percentages

Examples


To examine the visual
freq_bar(mtcars, as.factor(cyl), fill = "dodgerblue", total = 32)[[1]]

To create a table
freq_bar(mtcars, as.factor(cyl), fill = "dodgerblue", total = 32)[[2]]

jpedroza1228/reg.diagnostics documentation built on June 15, 2022, 9:30 p.m.