Exporting a list of R packages to install on a new machine


In preparation for fieldwork I wanted to replicate my R environment as best I could on a laptop I had borrowed from the University. Part of this involved installing packages.

To get a list of packages on my own laptop I ran:

packs <- installed.packages()

packs_names <- packs[,1]

Then I saved that as a .csv and emailed myself the file on the new computer:

write.csv(packs_names, "names.csv")

On the new computer, I opened R, then opened the csv and installed the packages.

packs <- read.csv("names.csv")