Hi all,
I'm trying to write a function to speed up a task I do every time I open R, which is load my favorite packages. I am trying to make it do the job of two commands in one; which is to say, load either just {tidyverse} and {janitor} or, if I toggle on an option, load a whole list of packages I use for running analysis. I can't get it to work for some reason though. Command so far is this:
prime_r=function(analyzing_data=TRUE){
if(analyzing_data=TRUE) {pacman::p_load(tidyverse, janitor, bayestestR, bayesplot, performance, effectsize, rstanarm, see, parameters, insight, report, flextable)}
if(analyzing_data=FALSE) {pacman::p_load(tidyverse, janitor)}
}
I can't even write the function into R's environment though; each time I try I get the following error:
Error: unexpected '}' in "}"
Anyone know what's wrong?