Another way to be able to record all the exact versions of the R packages being used (even BioConductor ones), and install them later, is using renv.
This gist shows an example where CRAN and Bioconductor packages are installed and recorded.
Later, the minimum information is put in a different directory (and machine), and all the installed packages and their dependencies are installed, using the same, exact version used when it was previously installed.