-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two new functions
- Loading branch information
Showing
26 changed files
with
290 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^\.github$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
inst/doc | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v1 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v1 | ||
with: | ||
extra-packages: rcmdcheck | ||
|
||
- uses: r-lib/actions/check-r-package@v1 | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload check results | ||
if: failure() | ||
uses: actions/upload-artifact@main | ||
with: | ||
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | ||
path: check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: test-coverage | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v1 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v1 | ||
with: | ||
extra-packages: covr | ||
|
||
- name: Test coverage | ||
run: covr::codecov() | ||
shell: Rscript {0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
.Rhistory | ||
.RData | ||
.Ruserdata | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
auto_set_format <- function() { | ||
if (knitr::is_latex_output()) { | ||
options(knitr.table.format = "latex") | ||
} else { | ||
options(knitr.table.format = "html") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#' pdf1_freq.tbl | ||
#' | ||
#' @description | ||
#' `r lifecycle::badge("experimental")` | ||
#' #'this is a very simple frequency 2x2 table generator | ||
#' | ||
#' @param obj Object used to create the table. Data frame, list or environment | ||
#' (or object coercible by as.data.frame to a data frame) | ||
#' @param tit Title for the table, write in string format | ||
#' @param v1 Variable that you want the table (not written in string format) | ||
#' @param v2 Variable that you want on the top of the table (not written in string format) | ||
#' @param ... Other arguments | ||
#' @param marg Marginal row table, default is FALSE | ||
|
||
#' @examples | ||
#' mtcars |> | ||
#' mypdf1::pdf1_freq.tbl2(cyl, am, "tit", marg = TRUE) | ||
#' @export | ||
pdf1_freq.tbl2 <- function(obj, v1, v2, tit, marg = F) { | ||
tab <- obj %>% | ||
dplyr::group_by({{ v1 }}, {{ v2 }}) %>% | ||
dplyr::summarise(n = dplyr::n()) %>% | ||
tidyr::spread({{ v2 }}, n) | ||
if (marg != TRUE) { | ||
title2 <- obj |> | ||
dplyr::select({{ v2 }}) |> | ||
names() | ||
catlev <- nrow(unique(obj |> | ||
dplyr::select({{ v2 }}))) + 1 | ||
tab <- tab |> | ||
janitor::adorn_totals("row") %>% | ||
janitor::adorn_totals("col") %>% | ||
dplyr::ungroup() |> | ||
mypdf1::pdf1_tbl(tit) |> | ||
kableExtra::add_header_above(c(" ", setNames(catlev, title2)), align = "c") | ||
} else { | ||
title2 <- obj |> | ||
dplyr::select({{ v2 }}) |> | ||
names() | ||
catlev <- nrow(unique(obj |> | ||
dplyr::select({{ v2 }}))) | ||
tab <- tab |> | ||
janitor::adorn_percentages() %>% | ||
dplyr::ungroup() |> | ||
mypdf1::pdf1_tbl(tit) |> | ||
kableExtra::add_header_above(c(" ", setNames(catlev, title2)), align = "c") | ||
} | ||
tab | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' pdf1_na | ||
#' | ||
#' @description | ||
#' `r lifecycle::badge("experimental")` | ||
#' this is a very simple table of the quantity of NA by variable | ||
#' | ||
#' @param obj Object used to create the table. Data frame, list or environment | ||
#' (or object coercible by as.data.frame to a data frame) | ||
#' @param ... Other arguments | ||
#' @examples | ||
#' airquality %>% | ||
#' mypdf1::pdf1_na() | ||
#' @export | ||
pdf1_na <- function(obj, ...) { | ||
vec <- is.na(obj) |> | ||
as.data.frame() |> | ||
purrr::map_dbl(sum) | ||
dplyr::tibble(`Variavel` = names(vec), `Total_Na` = vec %>% as.vector()) | ||
} |
Oops, something went wrong.