[codeface] [PATCH 1/9] Change package load order for plyr

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Thu, 16 Jun 2016 22:46:26 +0200

In certain circumstances (for instance, R 3.2.5, ggplot2 2.1.0
and plyr 1.8.3), loading plyr after ggplot2 causes import errors:

library(ggplot2)
library(plyr)
Error in unloadNamespace(package) :
  namespace ‘plyr’ is imported by ‘ggplot2’, ‘scales’ so cannot be unloaded
Error in library(plyr) : Package ‘plyr’ version 1.8.3 cannot be unloaded

Fix this by adapting the package load order.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 codeface/R/cluster/persons.r | 2 +-
 codeface/R/complexity.r      | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/codeface/R/cluster/persons.r b/codeface/R/cluster/persons.r
index 44b33fd..c664c2e 100755
--- a/codeface/R/cluster/persons.r
+++ b/codeface/R/cluster/persons.r
@@ -39,10 +39,10 @@ suppressPackageStartupMessages(library(igraph))
 suppressPackageStartupMessages(library(stringr))
 suppressPackageStartupMessages(library(xtable))
 suppressPackageStartupMessages(library(logging))
+suppressPackageStartupMessages(library(plyr))
 suppressPackageStartupMessages(library(reshape))
 suppressPackageStartupMessages(library(ggplot2))
 suppressPackageStartupMessages(library(optparse))
-suppressPackageStartupMessages(library(plyr))
 source("../utils.r", chdir=TRUE)
 source("../config.r", chdir=TRUE)
 source("../db.r", chdir=TRUE)
diff --git a/codeface/R/complexity.r b/codeface/R/complexity.r
index 9f2311e..c856489 100755
--- a/codeface/R/complexity.r
+++ b/codeface/R/complexity.r
@@ -18,15 +18,13 @@
 ## Analysis pass that computes complexity and cost estimate metrics
 ## using understand and sloccount
 
-suppressPackageStartupMessages(library(stringr))
-suppressPackageStartupMessages(library(lubridate))
-suppressPackageStartupMessages(library(reshape))
 source("config.r")
 source("db.r")
 source("query.r")
 source("system.r")
 source("mc_helpers.r")
 source("sloccount.r")
+suppressPackageStartupMessages(library(reshape))
 
 ## Sample commits from a given release range, and ensure that the sampled
 ## commits are properly time-ordered
-- 
2.8.3


Other related posts:

  • » [codeface] [PATCH 1/9] Change package load order for plyr - Wolfgang Mauerer