Our R scripts are used on multiple users on multiple computers and hence there are deviations in which packages are installed on each computer. To ensure that each script wo
Use library(x,character.only=TRUE)
. Also you don't need the last line as suppressPackageStartupMessages(library(x,character.only=TRUE))
already loads the package.
EDIT: @LarsKotthoff is right, you already load the package inside of the if brackets. There you already use option character.only=TRUE so everything is good if you just remove last to lines of your function body.