insightsengineering / insightsengineering/teal.picks

[Feature Request]: Add `keep_character` parameter to `is_categorical` function

Open Beginner friendly
#100 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
R
Stars
4
Forks
0
Avg merge
6d 11h
Merged PRs (30d)
3

Description

### Feature description

Currently the function keeps both factors and characters objects when filtering, however, in `tmg` there are situations where we are only interested in `factors` in order to exclude fields such as `STUDYID` or `USUBJID`.

If we want to exclude them currently we need to set `min.length = 2` (exclude singular values) and `max.length = 10` (exclude above a certain threshold)

However, it also excludes fields such as age unit (`AGEU`).

### Suggestion

```r
teal.picks::is_categorical(min.len, max.len, keep_factors = TRUE, keep_characters = TRUE)
```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [x] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [x] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Research direction

Start by locating the `is_categorical` function and inspect how it currently filters factor and character objects using `min.len` and `max.len`. Add the requested option so factors can be retained independently of characters, then verify that fields such as `STUDYID`, `USUBJID`, and `AGEU` produce the intended filtering behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.