-
I have a dataframe which looks like this:
I want to replace all truncated terms (e.g. Since there are multiple truncated terms, I'd like to replace them all with the appropriate full description. The catch is, I'd like to do it elegantly. I can do each individually like so: df %>% mutate_all(funs(str_replace(., "generation of precursor metabolites...",
"generation of precursor metabolites and energy"))) But, I don't want to have to repeat that over in over, where I swap out the find/replace terms. I'd prefer an option where I have two vectors: original_term <- c()
full_term <- c() Then, I somehow magically have R use those to do the find/replace. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
It is not clear if you already have the full terms in a dataframe. If you already do why not just join? |
Beta Was this translation helpful? Give feedback.
-
Also, on a side note, I came across some info that indicates TopGO does the same truncation, but can be remedied by adding the |
Beta Was this translation helpful? Give feedback.
-
I'm still curious about the find/replace solution, however, the the developer of GSEAbase has fixed the problem! That was really fast and really nice! If anyone's interested in getting the fix, you'll need to install the developer version of GSEAbase (follow the link for instructions on how to do this). |
Beta Was this translation helpful? Give feedback.
I'm still curious about the find/replace solution, however, the the developer of GSEAbase has fixed the problem! That was really fast and really nice! If anyone's interested in getting the fix, you'll need to install the developer version of GSEAbase (follow the link for instructions on how to do this).