I'm relatively new to R. I have a data framework that has a column stored as a list. My column contains c("Benzo", "Ferri")or character(0)if it is empty. How can I change them simply Benzo, Ferriand empty string for character (0) instead?
I can’t, for example df$general_RN <- unlist(df$general_RN), becauseError in $<-.data.frame(*tmp*, general_RN, value = c("Drug Combinations", : replacement has 1992 rows, data has 10479
I assume that all character(0)were deleted, but I need them to be saved as NAs.
Here is a column
general_RN
c("Chlorambucil", "Vincristine", "Cyclophosphamide")
Pentazocine
character(0)
character(0)
c("Ampicillin", "Trimethoprim")
character(0)
I was ashamed to spend an hour on this problem.
Thanks for your advice.
source
share