df2gg: Convert 'data.frame' object to 'ggplot' object

View source: R/utils_ggplot.R

df2ggR Documentation

Convert data.frame object to ggplot object

Description

[Experimental]

Given a data.frame object, performs basic conversion to a ggplot2::ggplot() object built using functions from the ggplot2 package.

Usage

df2gg(
  df,
  colwidths = NULL,
  font_size = 10,
  col_labels = TRUE,
  col_lab_fontface = "bold",
  hline = TRUE,
  bg_fill = NULL
)

Arguments

df

(data.frame)
a data frame.

colwidths

(numeric or NULL)
a vector of column widths. Each element's position in colwidths corresponds to the column of df in the same position. If NULL, column widths are calculated according to maximum number of characters per column.

font_size

(numeric(1))
font size.

col_labels

(flag)
whether the column names (labels) of df should be used as the first row of the output table.

col_lab_fontface

(string)
font face to apply to the first row (of column labels if col_labels = TRUE). Defaults to "bold".

hline

(flag)
whether a horizontal line should be printed below the first row of the table.

bg_fill

(string)
table background fill color.

Value

A ggplot object.

Examples

## Not run: 
df2gg(head(iris, 5))

df2gg(head(iris, 5), font_size = 15, colwidths = c(1, 1, 1, 1, 1))

## End(Not run)

tern documentation built on June 22, 2024, 10:25 a.m.