NAs in pluralize vector cause values to not display correctly

Open
#717 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
cli

Research direction

Start by reproducing the four examples in the issue and trace the pluralize() entry point to the code handling vector values. Add regression coverage for vectors containing NA_character_ values, then verify that the displayed vector preserves the NAs and rerun the relevant test suite.

Written by the indexing model from the issue text.

Description

bug

See the following reprex:

library(cli)

pluralize('{c(NA_character_)} file{?s}')
#> NA file
pluralize('{c("file1", NA_character_)} file{?s}')
#> NA files
pluralize('{c(NA_character_, "file1")} file{?s}')
#> NA files
pluralize('{c("file1", "file2", NA_character_)} file{?s}')
#> NA files

Created on 2024-08-15 with reprex v2.1.1

I believe the expected behavior should be to have the vector displayed as is with the included NAs.

Dominant language
R
Stars
726
Forks
94
Avg merge
3h 35m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/cli

All issues in r-lib/cli

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.