insightsengineering / insightsengineering/chevron
character or factor in dataset
- Dominant language
- R
- Stars
- 19
- Forks
- 1
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
in rtables, both character and factor are allowed, however there are cases that lead to the following error like
```
Error: Error applying analysis function (var - RACE): Number of rows generated by analysis function do not match across all columns.
```
This error message is not clear to the end users.
So the question here is: shall chevron always require "factor" used, or allow "character"?
option 1: chevron require factors be used. And in preprocessing convert all necessary variables to factor.
pro:
1. easier to use (minimal requirement for the data)
cons:
1. preprocessing is much complicated
2. custom preprocessing require more user effort
option 2: chevron require factors/character be used. In preprocessing convert some of the variables to factor (only if called with analyze_vars. Any other possibilities that this error could occur? @Melkiades )
pro:
1. easier to use (minimal requirement for the data)
2. minimal changes needed
cons:
1. only several preprocessing is complicated
option 3: chevron still allows characters (as this is supported by rtables), and rtables/tern may improve the handling of such situation
pros:
1. users are able to understand the error even if they are not using chevron
2. chevron will still be simple (and robust to data) from the users' side (in most of the cases; only in cases that different arm have different levels will this issue occur)
cons:
1. users still need to manually adjust the data (convert to factor) if rtable/tern only provide "warnings" if not provide solution to make it work
2. to eliminate the error can be incompatible with the current design
@Melkiades may I ask if there are any differences between `factor` and `character` in rtables?
Contributor guide
Assessment
This issue has not been assessed yet.