Package 'fastrep'

Title: Time-Saving Package for Creating Reports
Description: Provides templates for reports in 'rmarkdown' and functions to create tables and summaries of data.
Authors: Alisson Rosa [aut, cre]
Maintainer: Alisson Rosa <[email protected]>
License: GPL
Version: 0.7
Built: 2025-02-06 03:41:38 UTC
Source: https://github.com/alissonrp/fastrep

Help Index


cross_tbl

Description

[Experimental]

This function makes cross tables, like all functions from fastrep you need to supply a data.frame, and in this case two variables.

Usage

cross_tbl(obj, var1, var2, title = "", marg = FALSE)

Arguments

obj

Object used to create the table. Data frame, list, or environment (or object coercible by as.data.frame to a data frame)

var1

Variable that you want the table (not written in string format)

var2

Variable that you want on the top of the table (not written in string format)

title

title for the table, write in string format

marg

Marginal row table, default is FALSE

Value

A knitr_kable with 2x2 table fitted

Examples

mtcars |>
  fastrep::cross_tbl(cyl, am, "title", marg = TRUE)

describe

Description

In the base R we have the function summary, but the output is no by default a data.frame, so describe is an enhancement of this function to summarize data frames.

Usage

describe(obj, na_rm = TRUE)

Arguments

obj

Object used to create the table. data.frame, list or environment (or object coercible by as.data.frame to a data.frame)

na_rm

option to remove NA from variables

Value

A tibble with n rows where n is equal to ncol(obj) and columns with the summary metrics

Examples

mtcars |>
  fastrep::describe()

airquality |> fastrep::describe(na_rm = FALSE)

iris |> fastrep::describe()

freq_tbl

Description

This function creates a frequency table, you only need to supply a data.frame and the variable to make the table.

Usage

freq_tbl(
  obj,
  var,
  sort_by = {
     {
         var
     }
 },
  desc = FALSE
)

Arguments

obj

Object used to create the table. Data frame, list or environment (or object coercible by as.data.frame to a data frame)

var

Variable that you want the table (not written in string format)

sort_by

Variable you want to sort the tibble

desc

if you want decreasing order put FALSE

Value

A tibble with 4 rows and 3 columns

Note

By default the sort_by is in alphabetical order of var

Examples

iris %>%
  fastrep::freq_tbl(Species) %>%
  fastrep::tbl("You can combine this function too!")

citation How to cite fastrep in your publications!

Description

citation How to cite fastrep in your publications!

Usage

rep_citation()

Value

A print in console indicating how to cite the package.


rep_na

Description

[Deprecated]

This function counts the number of NA by variable in your data.frame

Usage

rep_na(obj, ...)

Arguments

obj

Object used to create the table.

data.frame, list or environment (or object coercible by as.data.frame to a data.frame)

...

Other arguments

Value

A tibble with n rows where n is equal to ncol(obj) and 2 columns

Examples

airquality %>%
  fastrep::rep_na()

tab

Description

This function is used to create cross_tbl

Usage

tab(obj, var1, var2)

Arguments

obj

Object used to create the table. Data frame, list, or environment (or object coercible by as.data.frame to a data frame)

var1

Variable that you want the table (not written in string format)

var2

Variable that you want on the top of the table (not written in string format)

Value

A tibble to create cross_tbl

Examples

mtcars |>
  fastrep::cross_tbl(cyl, am)

tbl

Description

This is the primary function of fastrep, with her you can make tables in HTML or LaTeX format, the main idea is to provide minimal parameters to create their own table, so you necessarily only need to provide a data.frame

Usage

tbl(
  obj,
  title = "",
  format = NULL,
  code = FALSE,
  tabs = FALSE,
  full_page = TRUE,
  ...
)

Arguments

obj

Object used to create the table.

data.frame, list or environment (or object coercible by as.data.frame to a data.frame)

title

Title for the table, write in string format

format

Format of table, write in string format. Possible values are "latex", "html".

code

If you want the table code to appear in the console, put code = TRUE, you can combine with format.

tabs

If you want a row separator inside table, put tabs = FALSE.

full_page

If you want the table not to take up the full width of the page, put full_page = FALSE.

...

Other arguments

Value

Your object of input in the format of a knitr_kable

Note

Remember that by default the format is "html"

The default of code is FALSE The default of tabs is TRUE The default of full_page is TRUE

The value of format will be automatically determined if the function is called within a knitr document

Examples

iris %>%
  dplyr::group_by(Species) %>%
  dplyr::summarise(mean = mean(Sepal.Length)) %>%
  fastrep::tbl("THIS FUNCTION IS SO INCREDIBLE!")

mtcars |>
  dplyr::group_by(carb) |>
  dplyr::summarise(sd = sd(wt)) |>
  fastrep::tbl()