When filtering a nested tibble down to zero rows (no match for the requested filter), printing that tibble in the context of a knit
(either a html_notebook or html_document) is throwing a warning of
Warning messages: 1: In
[<-.data.frame(
tmp, is_list, value = list(
11 = "<>")) : replacement element 1 has 1 row to replace 0 rows
The below reprex will generate the warning when embedded in a notebook and knitted to html_document. Any thoughts on where the best place to file this issue? I'm unsure as to whether this is a tidyverse (or what part of tidyverse), knitr, rmarkdown, or Rstudio issue. It was driving me batty just tracking it down and my brain is a bit mushy now.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
mt_df <- mtcars %>% tidyr::nest(data = c(cyl))
mt_df %>% filter(disp == 6)
#> # A tibble: 0 x 11
#> # … with 11 variables: mpg <dbl>, disp <dbl>, hp <dbl>, drat <dbl>, wt <dbl>,
#> # qsec <dbl>, vs <dbl>, am <dbl>, gear <dbl>, carb <dbl>, data <list>
mt_df %>% filter(disp == 999)
#> # A tibble: 0 x 11
#> # … with 11 variables: mpg <dbl>, disp <dbl>, hp <dbl>, drat <dbl>, wt <dbl>,
#> # qsec <dbl>, vs <dbl>, am <dbl>, gear <dbl>, carb <dbl>, data <list>
Created on 2021-02-04 by the reprex package (v1.0.0)
Session info
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] dplyr_1.0.2
#>
#> loaded via a namespace (and not attached):
#> [1] knitr_1.31 magrittr_2.0.1 tidyselect_1.1.0 R6_2.5.0
#> [5] rlang_0.4.10 fansi_0.4.1 stringr_1.4.0 styler_1.3.2
#> [9] highr_0.8 tools_4.0.3 xfun_0.19 utf8_1.1.4
#> [13] cli_2.3.0 htmltools_0.5.0 ellipsis_0.3.1 assertthat_0.2.1
#> [17] yaml_2.2.1 digest_0.6.27 tibble_3.0.6 lifecycle_0.2.0
#> [21] crayon_1.4.0 tidyr_1.1.2 purrr_0.3.4 vctrs_0.3.6
#> [25] fs_1.5.0 glue_1.4.2 evaluate_0.14 rmarkdown_2.6
#> [29] reprex_1.0.0 stringi_1.5.3 compiler_4.0.3 pillar_1.4.7
#> [33] generics_0.1.0 backports_1.2.1 pkgconfig_2.0.3