Dear community,
I would love to receive you help by the following problem: I have a data frame (df) with the columns "ID" and "sex" (which refers to the single ID). Herefore, I have the values 1, 2, and 3 which stand for the labels female, male, and divers. I strive for a solution, where the code df$sex gives me an output where a table is shown, that is named "Labels" that gives me the "meaning" of each value (see picture).
This should appear additionally to the output where ALL objects of my data frame are shown with the values 1-3. But I don't need an output where, instead of the values 1-3, the labels female, male, or divers are shown.
I already tried some functions with "ordered" or "factor", but all of them were not appropriate for solving my issue.
PS: I am new to this community. I am sorry if I missed any details of your community rules.