APAhtmlTable: A Function to Create APA Formatted HTML Tables

Description Usage Arguments Examples

Description

This function allows you to print the output of data frames and most R functions in an APA formatted table.

Usage

1
2
3
4
5
APAhtmlTable(df = NULL, round = TRUE, tidy = TRUE, digits = 3,
  genNote = NULL, font = "Times New Roman", fontSize = 12,
  tableNum = NULL, tableTitle = NULL, headerBold = FALSE,
  headerAlign = "center", leftColAlign = "left",
  contentAlign = "center", header = NULL)

Arguments

df

Data Frame or Function output to print in an APA formatted HTML table. Defaults to NULL.

tidy

Do you want to convert the object into a data frame (TRUE/FALSE). This is accomplished using the Tidy() function in the package Broom. Defaults to TRUE.

digits

Number of digits you want to round numbers too. Leave blank if you don't want to round numbers or if the Data Frame contains strings. Defaults to NULL.

genNote

General note to be displayed below the table (Automatically begins with NOTE. "Your note here"). Defaults to NULL.

font

Sets the font that text is displayed in. Defaults to Times New Roman.

tableNum

Adds a table number above the table. Format is "Table XX". If NULL, no table number is displayed. Defualts to NULL.

tableTitle

Adds a title above the table. If NULL, no title will be displayed. Defaults to NULL.

headerBold

Do you want the column headers to be bolded (TRUE/FALSE)? Defaults to FALSE.

headerAlign

Sets the horizontal alignment of the column headers ("left","center","right"). Defaults to "center".

leftColAlign

Sets the horizontal alignment of the first column in the table ("left","center","right"). Defaults to "left".

contentAlign

Sets the horizontal alignment of all other cells in the table besides the header (see headerAlign) and left column (see leftColAlign).

header

Manually define the column headers as a list. The length of the list must match the number of columns in the table. Defaults to NULL.

fontsize

Sets the font size of all text in the table. Defaults to 12pt.

Examples

1
2
3
lm.obj <- lm(mpg~am+disp, data=mtcars)
lm.summary <- summary(lm.obj)
APAhtmlTable(df=lm.summary, digits=3, tableNum=1, tableTitle="Miles per Gallon Regressed on Transmission Type and Displacement", header=c("Term","Estimate","SE","t","p"))

matthew-quesnel/simplePsych documentation built on May 17, 2019, 12:02 p.m.