Skip to content

Commit

Permalink
Merge pull request #955 from tidyverse/importFrom_lifecycle
Browse files Browse the repository at this point in the history
- Avoid blanket import for lifecycle package for compatibility with upcoming rlang (#955, @romainfrancois).
  • Loading branch information
krlmlr committed Sep 26, 2021
2 parents b0bab86 + 26dce68 commit 837eb52
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ubuntu-18.04-r-dev-release-${{ matrix.package }}-${{steps.date.outputs.date}}
restore-keys: ubuntu-18.04-r-dev-release-${{ matrix.package }}-
key: ubuntu-18.04-r-dev-release-${{ matrix.package }}-1-${{steps.date.outputs.date}}
restore-keys: ubuntu-18.04-r-dev-release-${{ matrix.package }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}${{ matrix.config.os-version }}-${{ hashFiles('.github/R-version') }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}${{ matrix.config.os-version }}-${{ hashFiles('.github/R-version') }}-2-
key: ${{ matrix.config.os }}${{ matrix.config.os-version }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}${{ matrix.config.os-version }}-${{ hashFiles('.github/R-version') }}-3-

- name: Install system dependencies
if: runner.os == 'Linux'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-2-

- name: Install system dependencies
if: runner.os == 'Linux'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ubuntu-18.04-${{ hashFiles('.github/R-version') }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ubuntu-18.04-${{ hashFiles('.github/R-version') }}-2-
key: ubuntu-18.04-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ubuntu-18.04-${{ hashFiles('.github/R-version') }}-3-

- name: Install system dependencies
if: runner.os == 'Linux'
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ VignetteBuilder:
knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1.9001
RoxygenNote: 7.1.2
Config/testthat/edition: 3
Config/testthat/parallel: true
Config/testthat/start-first: subsetting, as_tibble, add, invariants
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ export(validate_tibble)
export(view)
exportClasses(tbl_df)
import(ellipsis)
import(lifecycle)
import(rlang)
importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecate_warn)
importFrom(lifecycle,expect_deprecated)
importFrom(magrittr,"%>%")
importFrom(methods,setOldClass)
importFrom(pillar,dim_desc)
Expand Down
2 changes: 1 addition & 1 deletion R/tibble-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#' @importFrom utils head tail
#' @importFrom pkgconfig set_config
#' @import rlang
#' @import lifecycle
#' @import ellipsis
#' @importFrom lifecycle deprecate_soft deprecate_warn expect_deprecated
#' @importFrom vctrs vec_as_location vec_as_location2 vec_as_names vec_as_names_legacy vec_c
#' @importFrom vctrs vec_is vec_rbind vec_recycle vec_size vec_slice vec_assign
#' @importFrom vctrs unspecified vec_as_subscript2 num_as_location vec_ptype_abbr
Expand Down
2 changes: 1 addition & 1 deletion man/enframe.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/tibble-package.Rd

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

14 changes: 10 additions & 4 deletions tests/testthat/_snaps/vignette-formats/formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ library(tidyr)
#> The following object is masked from 'package:testthat':
#>
#> matches

stocks <-
expand_grid(id = factor(1:4), year = 2018:2022) %>%
mutate(stock = currency(runif(20) * 10000))
Expand Down Expand Up @@ -137,13 +136,21 @@ stocks %>%
It pays off to specify formatting very early in the process.
The diagram below shows the principal stages of data analysis and exploration from "R for data science".

![](${TEMP}/formats_files/figure-markdown_strict/unnamed-chunk-8-1.png)

```{=html}
<div id="htmlwidget-dbf0c8daf9db0415fdf5" style="width:672px;height:480px;" class="DiagrammeR html-widget"></div>
<script type="application/json" data-for="htmlwidget-dbf0c8daf9db0415fdf5">{"x":{"diagram":"graph TD\n Import --> Tidy\n Tidy --> Transform\n Transform --> Visualize\n Visualize --> Communicate\n Visualize --> Model\n Model -.-> Transform"},"evals":[],"jsHooks":[]}</script>
```

The subsequent diagram adds data formats, communication options, and explicit data formatting.
The original r4ds transitions are highlighted in bold.
There are two principal options where to apply formatting for results: right before communicating them, or right after importing.

![](${TEMP}/formats_files/figure-markdown_strict/unnamed-chunk-9-1.png)

```{=html}
<div id="htmlwidget-ec529900dc9c9fda496e" style="width:672px;height:480px;" class="DiagrammeR html-widget"></div>
<script type="application/json" data-for="htmlwidget-ec529900dc9c9fda496e">{"x":{"diagram":"graph TD\n .csv --> Import\n API --> Import\n DBI --> Import\n dbplyr --> Import\n Import -.-> Format[Format for analysis]\n Format -.-> Tidy\n\n subgraph r4ds\n Import ==> Tidy\n Tidy ==> Transform\n Transform ==> Visualize\n Visualize ==> Model\n Model -.-> Transform\n Visualize ==> Communicate\n end\n\n Visualize -.-> FormatComm[Format for communication]\n FormatComm -.-> Communicate\n\n FormatComm -- Apply formatting early --> Format\n\n dbplyr -.-> Tidy\n dbplyr -.-> Transform\n dbplyr -.-> Visualize\n\n Communicate --> gt\n Communicate --> ggplot2\n Communicate --> DT\n Communicate --> plotly"},"evals":[],"jsHooks":[]}</script>
```

Applying formatting early in the process gives the added benefit of showing the data in a useful format during the "Tidy", "Transform", and "Visualize" stages.
For this to be useful, we need to ensure that the formatting options applied early:
Expand Down Expand Up @@ -181,7 +188,6 @@ tbl3
#> 1 a 9 10 81 91 9 0.412 112. 1
#> 2 b 10 11 100 111 9 -0.544 112. 1
#> 3 c 11 12 121 133 10 -1.00 112. 1

tbl3 %>%
mutate(
across(where(is.numeric), digits, 3),
Expand Down
6 changes: 0 additions & 6 deletions tests/testthat/_snaps/vignette-invariants/invariants.md
Original file line number Diff line number Diff line change
Expand Up @@ -3353,12 +3353,6 @@ with_tbl(tbl[1] <- list(matrix(1:8, ncol = 2)))
#> 4 4 8 h <chr [1]>
```

</td></tr><tr style="vertical-align:top"><td>


</td><td>


</td></tr><tr style="vertical-align:top"><td>

```r
Expand Down

0 comments on commit 837eb52

Please sign in to comment.