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 |
This function makes cross tables, like all functions from fastrep you need to supply a data.frame, and in this case two variables.
cross_tbl(obj, var1, var2, title = "", marg = FALSE)
cross_tbl(obj, var1, var2, title = "", marg = FALSE)
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 |
A knitr_kable with 2x2 table fitted
mtcars |> fastrep::cross_tbl(cyl, am, "title", marg = TRUE)
mtcars |> fastrep::cross_tbl(cyl, am, "title", marg = TRUE)
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.
describe(obj, na_rm = TRUE)
describe(obj, na_rm = TRUE)
obj |
Object used to create the table.
|
na_rm |
option to remove |
A tibble with n rows where n is equal to ncol(obj)
and columns
with
the summary metrics
mtcars |> fastrep::describe() airquality |> fastrep::describe(na_rm = FALSE) iris |> fastrep::describe()
mtcars |> fastrep::describe() airquality |> fastrep::describe(na_rm = FALSE) iris |> fastrep::describe()
This function creates a frequency table, you only need to supply a data.frame and the variable to make the table.
freq_tbl( obj, var, sort_by = { { var } }, desc = FALSE )
freq_tbl( obj, var, sort_by = { { var } }, desc = FALSE )
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 |
desc |
if you want decreasing order put |
A tibble with 4 rows and 3 columns
By default the sort_by
is in alphabetical order of var
iris %>% fastrep::freq_tbl(Species) %>% fastrep::tbl("You can combine this function too!")
iris %>% fastrep::freq_tbl(Species) %>% fastrep::tbl("You can combine this function too!")
fastrep
in your publications!citation
How to cite fastrep
in your publications!
rep_citation()
rep_citation()
A print in console indicating how to cite the package.
This function counts the number of NA by variable in your data.frame
rep_na(obj, ...)
rep_na(obj, ...)
obj |
Object used to create the table.
|
... |
Other arguments |
A tibble with n rows where n is equal to ncol(obj)
and 2 columns
airquality %>% fastrep::rep_na()
airquality %>% fastrep::rep_na()
This function is used to create cross_tbl
tab(obj, var1, var2)
tab(obj, var1, var2)
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) |
A tibble to create cross_tbl
mtcars |> fastrep::cross_tbl(cyl, am)
mtcars |> fastrep::cross_tbl(cyl, am)
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
tbl( obj, title = "", format = NULL, code = FALSE, tabs = FALSE, full_page = TRUE, ... )
tbl( obj, title = "", format = NULL, code = FALSE, tabs = FALSE, full_page = TRUE, ... )
obj |
Object used to create the table.
|
title |
Title for the table, write in string format |
format |
Format of table, write in string format. Possible values are |
code |
If you want the table code to appear in the console, put |
tabs |
If you want a row separator inside table, put |
full_page |
If you want the table not to take up the full width of the page, put |
... |
Other arguments |
Your object of input in the format of a knitr_kable
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
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()
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()