Elegant way to check for missing packages and install them?

Yes. If you have your list of packages, compare it to the output from installed.packages()[,”Package”] and install the missing packages. Something like this: list.of.packages <- c(“ggplot2”, “Rcpp”) new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,”Package”])] if(length(new.packages)) install.packages(new.packages) Otherwise: If you put your code in a package and make them dependencies, then they will automatically be installed when you … Read more

Sibling package imports

Tired of sys.path hacks? There are plenty of sys.path.append -hacks available, but I found an alternative way of solving the problem in hand. Summary Wrap the code into one folder (e.g. packaged_stuff) Create setup.py script where you use setuptools.setup(). (see minimal setup.py below) Pip install the package in editable state with pip install -e <myproject_folder> … Read more