Skip to content

Instantly share code, notes, and snippets.

@wch
Created November 6, 2012 16:12
Show Gist options
  • Save wch/4025734 to your computer and use it in GitHub Desktop.
Save wch/4025734 to your computer and use it in GitHub Desktop.
Using plyr with dev_mode

Using the plyr 1.8 Release Candidate in dev_mode()

Using the plyr 1.8 RC with dev_mode() in devtools requires an extra step. This is because devtools depends on stringr, which depends on plyr, and R does not normally let you unload a package that other loaded packages depend on.

If you want to test the new version of plyr in dev mode, first install it with dev_mode():

library(devtools)
dev_mode()
install_github("plyr", ref = "plyr-1.8-rc")

After it's installed, you can switch to the new version of plyr. Start a new R session, then:

# Note that this requires devtools 0.8
# Loading devtools will automatically load your regular version of plyr
library(devtools)
dev_mode(TRUE)

# Unload current version of plyr, then load new version
devtools:::unregister_namespace('plyr')
library(plyr)

# Check that we're using the new version
packageVersion('plyr')
# [1] ‘1.8’

After you've loaded the new version of plyr, any packages that you load that depend on plyr will use the new version. At this point, you can test your existing code against it.

Note that if you want to test your code against the new version, it's best to reload plyr first, before doing anything else. This is because any packages that were loaded before loading the new plyr will continue to use functions from the old plyr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment