Skip to content

Commit

Permalink
Merge pull request #523 from yjunechoe/docs-tidyselect
Browse files Browse the repository at this point in the history
tidyselect in readme and vignettes
  • Loading branch information
rich-iannone committed Feb 29, 2024
2 parents ea0388b + 750b169 commit 8ea5f06
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion R/incorporate.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#' info = "Time-based values (e.g., `Sys.time()`)."
#' ) %>%
#' info_columns(
#' columns = "date",
#' columns = date,
#' info = "The date part of `date_time`. ((CALC))"
#' ) %>%
#' info_section(
Expand Down
24 changes: 12 additions & 12 deletions R/info_add.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,15 @@ info_tabular <- function(
#' # R statement
#' informant %>%
#' info_columns(
#' columns = "date_time",
#' columns = date_time,
#' info = "*info text* 1."
#' ) %>%
#' info_columns(
#' columns = "date",
#' columns = date,
#' info = "*info text* 2."
#' ) %>%
#' info_columns(
#' columns = "item_count",
#' columns = item_count,
#' info = "*info text* 3. Statistics: {snippet_1}."
#' ) %>%
#' info_columns(
Expand Down Expand Up @@ -409,7 +409,7 @@ info_tabular <- function(
#' info = "Time-based values (e.g., `Sys.time()`)."
#' ) %>%
#' info_columns(
#' columns = "date",
#' columns = date,
#' info = "The date part of `date_time`. ((CALC))"
#' )
#' ```
Expand Down Expand Up @@ -609,11 +609,11 @@ info_columns <- function(
#' informant <-
#' informant %>%
#' info_columns(
#' columns = "item_revenue",
#' columns = item_revenue,
#' info = "Revenue reported in USD."
#' ) %>%
#' info_columns(
#' columns = "acquisition",
#' columns = acquisition,
#' `top list` = "{top5_aq}"
#' ) %>%
#' info_snippet(
Expand Down Expand Up @@ -1013,7 +1013,7 @@ info_section <- function(
#' # R statement
#' informant %>%
#' info_columns(
#' columns = "date_time",
#' columns = date_time,
#' `Latest Date` = "The latest date is {latest_date}."
#' ) %>%
#' info_snippet(
Expand Down Expand Up @@ -1076,7 +1076,7 @@ info_section <- function(
#' info = "Time-based values (e.g., `Sys.time()`)."
#' ) %>%
#' info_columns(
#' columns = "date",
#' columns = date,
#' info = "The date part of `date_time`. ((CALC))"
#' ) %>%
#' info_section(
Expand Down Expand Up @@ -1264,7 +1264,7 @@ info_snippet <- function(
#' label = "An example."
#' ) %>%
#' info_columns(
#' columns = "f",
#' columns = f,
#' `Items` = "This column contains {values_f}."
#' ) %>%
#' info_snippet(
Expand Down Expand Up @@ -1495,7 +1495,7 @@ snip_list <- function(
#' label = "An example."
#' ) %>%
#' info_columns(
#' columns = "d",
#' columns = d,
#' `Stats` = "Stats (fivenum): {stats_d}."
#' ) %>%
#' info_snippet(
Expand Down Expand Up @@ -1574,7 +1574,7 @@ snip_stats <- function(
#' label = "An example."
#' ) %>%
#' info_columns(
#' columns = "a",
#' columns = a,
#' `Lowest Value` = "Lowest value is {lowest_a}."
#' ) %>%
#' info_snippet(
Expand Down Expand Up @@ -1648,7 +1648,7 @@ snip_lowest <- function(column) {
#' label = "An example."
#' ) %>%
#' info_columns(
#' columns = "a",
#' columns = a,
#' `Highest Value` = "Highest value is {highest_a}."
#' ) %>%
#' info_snippet(
Expand Down
4 changes: 2 additions & 2 deletions R/object_ops.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
#' info = "Time-based values."
#' ) %>%
#' info_columns(
#' columns = "date",
#' columns = date,
#' info = "The date part of `date_time`."
#' ) %>%
#' incorporate()
Expand Down Expand Up @@ -680,7 +680,7 @@ x_read_disk <- function(
#' info = "Time-based values."
#' ) %>%
#' info_columns(
#' columns = "date",
#' columns = date,
#' info = "The date part of `date_time`."
#' ) %>%
#' incorporate()
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ dplyr::tibble(
b = c(6, 1, 0, 6, 0, 7)
) %>%
col_vals_between(
vars(a), 1, 9,
a, 1, 9,
na_pass = TRUE
) %>%
col_vals_lt(
vars(c), 12,
c, 12,
preconditions = ~ . %>% dplyr::mutate(c = a + b)
) %>%
col_is_numeric(vars(a, b))
col_is_numeric(c(a, b))
```

Error: Exceedance of failed test units where values in `c` should have been < `12`.
Expand All @@ -169,17 +169,17 @@ dplyr::tibble(
b = c(6, 1, 0, 6, 0, 7)
) %>%
col_vals_between(
vars(a), 1, 9,
a, 1, 9,
na_pass = TRUE,
actions = warn_on_fail()
) %>%
col_vals_lt(
vars(c), 12,
c, 12,
preconditions = ~ . %>% dplyr::mutate(c = a + b),
actions = warn_on_fail()
) %>%
col_is_numeric(
vars(a, b),
c(a, b),
actions = warn_on_fail()
)
```
Expand Down Expand Up @@ -267,19 +267,19 @@ informant <-
`README` pages. Column names are `a` and `b`. ((Cool stuff))"
) %>%
info_columns(
columns = "a",
columns = a,
info = "This column has an `NA` value. [[Watch out!]]<<color: red;>>"
) %>%
info_columns(
columns = "a",
columns = a,
info = "Mean value is `{a_mean}`."
) %>%
info_columns(
columns = "b",
columns = b,
info = "Like column `a`. The lowest value is `{b_lowest}`."
) %>%
info_columns(
columns = "b",
columns = b,
info = "The highest value is `{b_highest}`."
) %>%
info_snippet(
Expand Down
20 changes: 10 additions & 10 deletions vignettes/INFO-1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ informant <-
description = "This table is included in the **pointblank** pkg."
) %>%
info_columns(
columns = "date_time",
columns = date_time,
info = "This column is full of timestamps."
) %>%
info_section(
Expand All @@ -97,7 +97,7 @@ The `info_tabular()` function adds information to the **TABLE** section. We use

```{r eval=FALSE}
informant %>%
info_tabular(`🔄 updates` = "This table is not regularly updated.")
info_tabular("🔄 updates" = "This table is not regularly updated.")
```

<div style="text-align: center;"><img src="https://silly-jackson-b3dec8.netlify.app/informant_report_4.png"
Expand Down Expand Up @@ -128,40 +128,40 @@ informant_pp <-
label = "The `penguins` dataset from the **palmerpenguins** 📦."
) %>%
info_columns(
columns = "species",
columns = species,
`ℹ️` = "A factor denoting penguin species (*Adélie*, *Chinstrap*, and *Gentoo*)."
) %>%
info_columns(
columns = "island",
columns = island,
`ℹ️` = "A factor denoting island in Palmer Archipelago, Antarctica
(*Biscoe*, *Dream*, or *Torgersen*)."
) %>%
info_columns(
columns = "bill_length_mm",
columns = bill_length_mm,
`ℹ️` = "A number denoting bill length"
) %>%
info_columns(
columns = "bill_depth_mm",
columns = bill_depth_mm,
`ℹ️` = "A number denoting bill depth"
) %>%
info_columns(
columns = "flipper_length_mm",
columns = flipper_length_mm,
`ℹ️` = "An integer denoting flipper length"
) %>%
info_columns(
columns = ends_with("mm"),
`ℹ️` = "(in units of millimeters)."
) %>%
info_columns(
columns = "body_mass_g",
columns = body_mass_g,
`ℹ️` = "An integer denoting body mass (grams)."
) %>%
info_columns(
columns = "sex",
columns = sex,
`ℹ️` = "A factor denoting penguin sex (`\"female\"`, `\"male\"`)."
) %>%
info_columns(
columns = "year",
columns = year,
`ℹ️` = "The study year (e.g., `2007`, `2008`, `2009`)."
)
Expand Down
22 changes: 11 additions & 11 deletions vignettes/INFO-2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The `small_table` dataset is associated with the `informant` as the target table
informant <-
informant %>%
info_columns(
columns = vars(d),
columns = d,
info = "This column contains fairly large numbers (much larger than
those numbers in column `a`. The mean value is {mean_d}, which is
far greater than any number in that other column."
Expand Down Expand Up @@ -76,7 +76,7 @@ informant <-
fn = ~ . %>% .$d %>% mean() %>% round(1)
) %>%
info_columns(
columns = vars(d),
columns = d,
info = "This column contains fairly large numbers (much larger than
those numbers in column `a`. The mean value is {mean_d}, which is
far greater than any number in that other column."
Expand Down Expand Up @@ -181,11 +181,11 @@ informant_pp <-
label = "The `penguins` dataset from the **palmerpenguins** 📦."
) %>%
info_columns(
columns = "species",
columns = species,
`ℹ️` = "A factor denoting penguin species ({species_snippet})."
) %>%
info_columns(
columns = "island",
columns = island,
`ℹ️` = "A factor denoting island in Palmer Archipelago, Antarctica
({island_snippet})."
) %>%
Expand Down Expand Up @@ -216,7 +216,7 @@ This also works for numeric values. Let's use `snip_list()` to provide a text sn
informant_pp <-
informant_pp %>%
info_columns(
columns = "year",
columns = year,
`ℹ️` = "The study year ({year_snippet})."
) %>%
info_snippet(
Expand Down Expand Up @@ -244,24 +244,24 @@ We can get the lowest and highest values from a column and inject those formatte
informant_pp <-
informant_pp %>%
info_columns(
columns = "bill_length_mm",
columns = bill_length_mm,
`ℹ️` = "A number denoting bill length"
) %>%
info_columns(
columns = "bill_depth_mm",
columns = bill_depth_mm,
`ℹ️` = "A number denoting bill depth (in the range of
{min_depth} to {max_depth} millimeters)."
) %>%
info_columns(
columns = "flipper_length_mm",
columns = flipper_length_mm,
`ℹ️` = "An integer denoting flipper length"
) %>%
info_columns(
columns = matches("length"),
`ℹ️` = "(in units of millimeters)."
) %>%
info_columns(
columns = "flipper_length_mm",
columns = flipper_length_mm,
`ℹ️` = "Largest observed is {largest_flipper_length} mm."
) %>%
info_snippet(
Expand Down Expand Up @@ -338,7 +338,7 @@ We can take portions of text and present them as labels. These will help you cal
informant_pp <-
informant_pp %>%
info_columns(
columns = vars(body_mass_g),
columns = body_mass_g,
`ℹ️` = "An integer denoting body mass."
) %>%
info_columns(
Expand Down Expand Up @@ -396,7 +396,7 @@ Continuing with our **palmerpenguins** reporting, we'll add some more *info text
informant_pp <-
informant_pp %>%
info_columns(
columns = vars(sex),
columns = sex,
`ℹ️` = "A [[factor]]<<text-decoration: underline;>>
denoting penguin sex (female or male)."
) %>%
Expand Down
Loading

0 comments on commit 8ea5f06

Please sign in to comment.