How to rename rows? (e.g. variable names) #966
Unanswered
lepromatous
asked this question in
Q&A
Replies: 1 comment
-
I don't quite know if I understand your problem correctly which is why it would be great to have a reprex. My 2 cents: You can use
In a clinical data workflow, you can make use of named vectors as code lists:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to rename the variable names in the gt output table? For example, it would be awesome if you could just pass a vector of new variable names in an option to rename the rows. I know whatever is in the data frame, name-wise, is what is used as the row labels in the gt() object, but variable names are usually not self explanatory or pretty, and renaming columns in a data frame to make them pretty is pretty much insanity. Specific example: if my variable name is 'race_aa' and it is coded 1,0, where 1 is "Black/African American", and 0 is "Other", I don't want race_aa to show as the rows - I want "Black/African American" to show. I would apply factor labels to get the 0/1 to show appropriately., however. Renaming my data frame with variable names with special characters or spaces is not cool. I have to be missing something. Any ideas are much appreciated!
Something like: df %>% gt() %>% append_row_names(new.names) where 'new.names' is a vector of names in the same order as what is in the output of gt()
Beta Was this translation helpful? Give feedback.
All reactions