Skip to content

Should we be using factors instead of character vectors? #33

@rpsychologist

Description

@rpsychologist

Wouldn't it be better if all categorical variables were factors? For example these (and probably others):

d_bl |>
select(where(is.character)) |>
glimpse()

Rows: 181
Columns: 5
$ gender    <chr> "Woman", "Man", "Man", "Man", "Woman", "Woman", "Woman", "Ma…
$ education <chr> "Primary", "University", "Secondary", "Secondary", "Universi…
$ income    <chr> "Medium", "Medium", "Medium", "Medium", "Medium", "Low", "Lo…
$ gad_cat   <chr> "Low anxiety", "High anxiety", "High anxiety", "Low anxiety"…
$ phq_cat   <chr> "Low depression", "High depression", "High depression", "Low…

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions