Skip to content

Clarify crossing factor level behavior#1632

Closed
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:codex/clarify-crossing-factor-levels
Closed

Clarify crossing factor level behavior#1632
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:codex/clarify-crossing-factor-levels

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Fixes #1526.

This clarifies that crossing() uses the full set of levels for factor inputs, not just the values present in the data. I kept the change scoped to crossing() because nesting() and expand_grid() do not independently expand factor levels in the same way.

Checks:

  • Focused check confirming crossing() expands the missing factor level in the issue reprex
  • Rscript -e 'tools::checkRd("man/expand.Rd")'\n- git diff --check\n- R CMD build --no-build-vignettes .\n- R_LIBS_USER=/tmp/tune-r-lib _R_CHECK_FORCE_SUGGESTS_=false R CMD check --no-manual --ignore-vignettes --no-build-vignettes --no-tests tidyr_1.3.2.9000.tar.gz

@DavisVaughan

Copy link
Copy Markdown
Member

Assuming this is the same as tidymodels/broom#1281 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crossing() adds missing factor levels (either a bug or a documentation issue)

2 participants