Skip to content

Commit

Permalink
Fix minor documention issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvartan committed Nov 17, 2021
1 parent 472922d commit ee9c495
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 52 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Suggests:
knitr (>= 1.36),
mockr (>= 0.1),
readr (>= 2.0.2),
rlang (>= 0.4.12),
rmarkdown (>= 2.11),
spelling (>= 2.2),
stats (>= 4.0.0),
Expand Down
3 changes: 1 addition & 2 deletions R/micro_mctq.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
#' If you prefer to view `Duration` objects as `hms` objects, run
#' `pretty_mctq(micro_mctq)`.
#'
#' @format A tibble with `r ncol(mctq::micro_mctq)` columns and
#' `r nrow(mctq::micro_mctq)` rows:
#' @format A [`tibble`][dplyr::tibble()] with 17 columns and 50 rows:
#'
#' \describe{
#' \item{id}{
Expand Down
2 changes: 1 addition & 1 deletion R/qplot_walk.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#' must apply a midday change for `hms` variables with values greater than
#' `22:00:00` (see Details section to learn more) (default: `TRUE`).
#'
#' @return An invisible `NULL`. `qplot_walk()` was made to only display plots.
#' @return An invisible `NULL`. This function don't aim to return values.
#'
#' @family utility functions
#' @export
Expand Down
3 changes: 1 addition & 2 deletions R/shift_mctq.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
#' If you prefer to view `Duration` objects as `hms` objects, run
#' `pretty_mctq(shift_mctq)`.
#'
#' @format A tibble with `r ncol(mctq::shift_mctq)` columns and
#' `r nrow(mctq::shift_mctq)` rows:
#' @format A [`tibble`][dplyr::tibble()] with 128 columns and 50 rows:
#'
#' \describe{
#' \item{id}{
Expand Down
3 changes: 1 addition & 2 deletions R/std_mctq.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
#' If you prefer to view `Duration` objects as `hms` objects, run
#' `pretty_mctq(std_mctq)`.
#'
#' @format A tibble with `r ncol(mctq::std_mctq)` columns and
#' `r nrow(mctq::std_mctq)` rows:
#' @format A [`tibble`][dplyr::tibble()] with 37 columns and 50 rows:
#'
#' \describe{
#' \item{id}{
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ library(hms)

<!-- badges: start -->
[![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/434_status.svg)](https://github.com/ropensci/software-review/issues/434)
[![CRAN status](https://www.r-pkg.org/badges/version/mctq)](https://CRAN.R-project.org/package=mctq)
[![CRAN status](https://www.r-pkg.org/badges/version/mctq)](https://cran.r-project.org/package=mctq)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/mctq)](https://cran.r-project.org/package=mctq)
[![mctq status badge](https://ropensci.r-universe.dev/badges/mctq)](https://ropensci.r-universe.dev)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
Expand Down Expand Up @@ -50,7 +50,7 @@ You need to have some familiarity with the [R programming language](https://www.

In case you don't feel comfortable with R, we strongly recommend checking Hadley Wickham and Garrett Grolemund free and online book [R for Data Science](https://r4ds.had.co.nz/) and the Coursera course from John Hopkins University [Data Science: Foundations using R](https://www.coursera.org/specializations/data-science-foundations-r) (free for audit students).

Please refer to the [lubridate](https://lubridate.tidyverse.org/) and [hms](https://hms.tidyverse.org/) package documentation to learn more about them. These two are essential packages to deal with date/time data in R. We also recommend that you read the [Dates and times](https://r4ds.had.co.nz/dates-and-times.html#time-spans) chapter from Wickham & Grolemund's book [R for Data Science](https://r4ds.had.co.nz/).
Please refer to the [lubridate](https://lubridate.tidyverse.org/) and [hms](https://hms.tidyverse.org/) package documentation to learn more about them. These two are essential packages to deal with date/time data in R. We also recommend that you read the [Dates and times](https://r4ds.had.co.nz/dates-and-times.html#dates-and-times) chapter from Wickham & Grolemund's book [R for Data Science](https://r4ds.had.co.nz/).

## Installation

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Status at rOpenSci Software Peer
Review](https://badges.ropensci.org/434_status.svg)](https://github.com/ropensci/software-review/issues/434)
[![CRAN
status](https://www.r-pkg.org/badges/version/mctq)](https://CRAN.R-project.org/package=mctq)
status](https://www.r-pkg.org/badges/version/mctq)](https://cran.r-project.org/package=mctq)
[![CRAN
downloads](https://cranlogs.r-pkg.org/badges/grand-total/mctq)](https://cran.r-project.org/package=mctq)
[![mctq status
Expand Down Expand Up @@ -78,8 +78,8 @@ Please refer to the [lubridate](https://lubridate.tidyverse.org/) and
[hms](https://hms.tidyverse.org/) package documentation to learn more
about them. These two are essential packages to deal with date/time data
in R. We also recommend that you read the [Dates and
times](https://r4ds.had.co.nz/dates-and-times.html#time-spans) chapter
from Wickham & Grolemund’s book [R for Data
times](https://r4ds.had.co.nz/dates-and-times.html#dates-and-times)
chapter from Wickham & Grolemund’s book [R for Data
Science](https://r4ds.had.co.nz/).

## Installation
Expand Down
29 changes: 17 additions & 12 deletions data-raw/micro_mctq.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Source the file before running the functions
# Don't forget to uncomment the `library` functions below
# # Notes
#
# * Source the file before running the functions.
# * Don't forget to uncomment the `library` functions below.

# library(checkmate)
# library(dplyr)
Expand Down Expand Up @@ -36,7 +38,8 @@
#' \dontrun{
#' if (requireNamespace("utils", quietly = TRUE)) {
#' utils::View(mctq::build_micro_mctq())
#' }}
#' }
#' }
build_micro_mctq <- function(write = FALSE, random_cases = TRUE) {
# Check arguments -----

Expand Down Expand Up @@ -296,16 +299,16 @@ build_micro_mctq <- function(write = FALSE, random_cases = TRUE) {
invisible(micro_mctq)
}

#' Tidy [mctq::build_micro_mctq()] output
#' Tidy `build_micro_mctq()` output
#'
#' @description
#'
#' `tidy_micro_mctq` tidy the output of [mctq::build_micro_mctq()]. See
#' [mctq::micro_mctq] to learn more.
#' `tidy_micro_mctq` tidy the output of `build_micro_mctq()`. See
#' [micro_mctq][mctq::micro_mctq] to learn more.
#'
#' @details
#'
#' Here, the process of _tiding_ a dataset is understood as transforming it in
#' Here the process of _tiding_ a dataset is understood as transforming it in
#' input data, like described in Loo and Jonge (2018). It's a very similar
#' process of tiding data described in the workflow proposed by Wickham and
#' Grolemund (n.d.).
Expand All @@ -330,10 +333,10 @@ build_micro_mctq <- function(write = FALSE, random_cases = TRUE) {
#'
#' @examples
#' \dontrun{
#' \dontrun{
#' if (requireNamespace("utils", quietly = TRUE)) {
#' utils::View(mctq::tidy_micro_mctq())
#' }}
#' }
#' }
tidy_micro_mctq <- function(write = FALSE) {
# Check arguments -----

Expand Down Expand Up @@ -411,7 +414,7 @@ tidy_micro_mctq <- function(write = FALSE) {
#'
#' Here, the process of _validating_ a dataset is understood as detecting
#' invalid data, by checking whether data satisfies certain assumptions from
#' domain knowledge, to them, removing or, if possible, fixing them. You can
#' domain knowledge, to then, removing or, if possible, fixing them. You can
#' find more about data validation and error location in Loo and Jonge (2018).
#'
#' This process can be considered as part of the process of transforming data,
Expand All @@ -430,7 +433,8 @@ tidy_micro_mctq <- function(write = FALSE) {
#' \dontrun{
#' if (requireNamespace("utils", quietly = TRUE)) {
#' utils::View(mctq::validate_micro_mctq())
#' }}
#' }
#' }
validate_micro_mctq <- function(write = FALSE) {
# To do -----
#
Expand Down Expand Up @@ -538,7 +542,8 @@ validate_micro_mctq <- function(write = FALSE) {
#' \dontrun{
#' if (requireNamespace("utils", quietly = TRUE)) {
#' utils::View(mctq::analyze_micro_mctq())
#' }}
#' }
#' }
analyze_micro_mctq <- function(write = FALSE, round = TRUE, hms = FALSE) {
# Check arguments -----

Expand Down
6 changes: 4 additions & 2 deletions data-raw/random_mctq.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Source the file before running the functions
# Don't forget to uncomment the `library` functions below
# # Notes
#
# * Source the file before running the functions.
# * Don't forget to uncomment the `library` functions below.

# library(checkmate)
# library(cli)
Expand Down
6 changes: 4 additions & 2 deletions data-raw/shift_mctq.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Source the file before running the functions
# Don't forget to uncomment the `library` functions below
# # Notes
#
# * Source the file before running the functions.
# * Don't forget to uncomment the `library` functions below.

# library(checkmate)
# library(dplyr)
Expand Down
24 changes: 11 additions & 13 deletions data-raw/std_mctq.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Source the file before running the functions
# Don't forget to uncomment the `library` functions below
# # Notes
#
# * Source the file before running the functions.
# * Don't forget to uncomment the `library` functions below.

# library(checkmate)
# library(dplyr)
Expand Down Expand Up @@ -828,10 +830,12 @@ validate_std_mctq <- function(write = FALSE) {
TRUE ~ FALSE)) %>%
dplyr::select(dummy)

std_mctq <- dplyr::bind_cols(std_mctq, test) %>%
dplyr::mutate(
dplyr::across(dplyr::ends_with(i),
~ dplyr::if_else(dummy, mctq:::na_as(.x), .x))) %>%
std_mctq <- std_mctq %>%
dplyr::bind_cols(test) %>%
dplyr::mutate(dplyr::across(
dplyr::ends_with(i),
~ dplyr::if_else(dummy, mctq:::na_as(.x), .x))
) %>%
dplyr::select(-dummy)
}

Expand Down Expand Up @@ -914,13 +918,7 @@ analyze_std_mctq <- function(write = FALSE, round = TRUE, hms = FALSE) {
checkmate::assert_flag(round)
checkmate::assert_flag(hms)

# Set values -----

std_mctq <- validate_std_mctq()

# Create computed variables -----

std_mctq <- std_mctq %>%
std_mctq <- validate_std_mctq() %>%
dplyr::mutate(
fd = fd(wd),
so_w = so(sprep_w, slat_w),
Expand Down
6 changes: 4 additions & 2 deletions data-raw/vignette_mctq.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Source the file before running the function
# Don't forget to uncomment the `library` functions below
# # Notes
#
# * Source the file before running the functions.
# * Don't forget to uncomment the `library` functions below.

# library(checkmate)
# library(dplyr)
Expand Down
3 changes: 1 addition & 2 deletions man/micro_mctq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/qplot_walk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/shift_mctq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/std_mctq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions tests/testthat/test-utils-dialogs.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,25 @@ test_that("dialog_line() | general test", {
is_interactive = function(...) TRUE,
require_namespace = function(...) TRUE,
read_line = function(...) TRUE,
dialog_line(1, combined_styles = "red", space_above = TRUE,
space_below = TRUE))
dialog_line(1, space_above = TRUE, space_below = TRUE))
}

expect_equal(utils::capture.output(mock()), c("", "", "[1] TRUE"))
})

test_that("dialog_line() | error test", {
# "assert_has_length(list(...))"
expect_error(dialog_line(), "Assertion on 'list\\(...\\)' failed")

# "checkmate::assert_flag(space_above)"
expect_error(dialog_line(1, space_above = ""),
"Assertion on 'space_above' failed")

# "checkmate::assert_flag(space_below)"
expect_error(dialog_line(1, space_below = ""),
"Assertion on 'space_below' failed")

# "checkmate::assert_flag(abort)"
expect_error(dialog_line(1, abort = ""),
"Assertion on 'abort' failed")
})

0 comments on commit ee9c495

Please sign in to comment.