Type: | Package |
Title: | Time-Saving Package for Creating Reports |
Version: | 0.7 |
Description: | Provides templates for reports in 'rmarkdown' and functions to create tables and summaries of data. |
License: | GPL-2 | GPL-3 [expanded from: GPL] |
Depends: | R (≥ 4.1.0) |
Imports: | dplyr, ggplot2, janitor, kableExtra, lifecycle, magrittr, purrr, tidyr |
Suggests: | covr, knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.0 |
BugReports: | https://github.com/AlissonRP/fastrep/issues |
NeedsCompilation: | no |
Packaged: | 2022-09-11 16:33:21 UTC; alissonrp |
Author: | Alisson Rosa [aut, cre] |
Maintainer: | Alisson Rosa <alirpereira887@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2022-09-12 10:42:56 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
cross_tbl
Description
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.
|
na_rm |
option to remove |
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 |
desc |
if you want decreasing order put |
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!")
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
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
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.
|
... |
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.
|
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 |
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()