make.table2 {litRiddle} | R Documentation |
Make Table of Two Variables and Plot
Description
A function to make a table of frequency counts for two variables, and to plot a histogram of the results.
Usage
make.table2(table.of = NULL,
split = NULL,
plot = TRUE,
xlab = table.of,
ylab = "counts",
title = table.of,
barcolor = "grey",
barfill = "darkgrey")
Arguments
table.of |
which variable will be chosen? If not sure what variables are there, try typing |
split |
the variable that will be used to split the data: see the Examples section below for, well, some examples. |
plot |
do you want a plot to be plotted? Default: |
xlab |
name of the X axis |
ylab |
name of the Y axis |
title |
title of the plot |
barcolor |
outline color of the content |
barfill |
color used to fill the bars |
Details
Unlike make.table
, this function provides a comparison
of two variables at a time, or to be more precise: a distribution of
an indicated variable when subdivided into two or more groups.
The function provides the values themselves, but also a final histrogram.
Value
A character vector containing one chosen variable, optionally followed by a plot.
Author(s)
Saskia Lensink, Maciej Eder
References
https://literaryquality.huygens.knaw.nl/
See Also
Examples
make.table2(table.of = "age.resp", split = "gender.resp")
make.table2(table.of = "literariness.read", split = "gender.author")
# Note that you can only provide an argument to the 'split' variable
# that has less than 31 unique values, to avoid uninterpretable outputs:
make.table2(table.of = "age.resp", split = "zipcode")
# You can also adjust the x label, y label, title, and colors.
make.table2(table.of = "age.resp", split = "gender.resp",
xlab = "age respondent", ylab = "number of people",
barcolor = "purple", barfill = "yellow")
make.table2(table.of = "literariness.read", split = "gender.author",
xlab = "Overall literariness scores", ylab = "number of people",
barcolor = "black", barfill = "darkred")