Skip to content

updating R

April 15, 2013

Updating versions of R can be a pain in terms of getting all those packages you had on the old version onto the new version. Some people suggest copying the library folder from one installation to another and running update.packages(). Other people have other methods.

Here’s my simple method:

On the old installation make a vector of names of packages and write it to a file:

packs <- row.names(installed.packages())
write.table(packs, "packs.txt") # could also use dump or save or....

On the new version of R just read in the file and run install.packages:

packs <- read.table("packs.txt")
install.packages(as.character(packs$x)) # *

Select the mirror and wait a few minutes.


* because this method ends up having packs as a table with 1 column (interpreted as a factor), we have to force R to think its a character

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: