df_replace: function that replaces (parts of) strings in a data.frame...

View source: R/workFlows.R

df_replaceR Documentation

function that replaces (parts of) strings in a data.frame according to a provided table of replacements

Description

function that replaces (parts of) strings in a data.frame according to a provided table of replacements

Usage

df_replace(df, str_replacements = replacementStrings())

Arguments

df

data.frame that needs to have strings replaced. Each cell is processed with str_replace_all from the stringr package for all elements of the str_replacements data.frame

str_replacements

data.frame defining the replacements, see replacementStrings for more information

Value

the data.frame with (parts of) strings replaced if present

Note

this function can be called just before passing a data.frame over to eg kableExtra::kbl(). When used in HTML markdown this function sometimes generates unintended behavior, eg converting (part of) strings to email addresses when they contain an @ sign. This functions can replace possible problematic parts with something else. This can be eg latex. For example: replace '@' with '$@$' will solve the email address 'problem'

for obvious reasons only character vector columns are processed


BenBruyneel/proteinDiscover documentation built on March 16, 2024, 4:36 p.m.