[Rd] Dependency problem for "hasArg"

From: Mauricio Zambrano-Bigiarini <mauricio.zambrano_at_jrc.ec.europa.eu>
Date: Mon, 02 Jul 2012 17:06:11 +0200

Dear list,

I'm running an R script which first line is:


While running that script from the system console (in Red Hat Enterprise Linux 6) I got the following error:

Error in plot2(x = sim, y = obs, plot.type = "single", main = paste("Daily", :

   could not find function "hasArg"
Calls: plot_results -> plot_out -> ggof -> plot2

However, if I call EXACTLY the same script from the R console, by using

 > source("myRscript.R")

I do not get any error.

As you can see in the error message, the function 'plot_results' calls 'plot_out' (both in the hydroPSO package). Then 'plot_out' calls the function 'ggof', which in turn calls 'plot2' (the latter 2 in the hydroGOF package), and 'plot2' has a call to 'hasArg'.

The package 'hydroGOF' exports all its functions by using:


At the other hand, the package 'hydroPSO' does not import any function of the 'hydroGOF' package, because the call to 'ggof' only occurs within the 'plot_out' function if the hydroGOF package is detected on the user machine:

if (!require(hydroGOF)) {

      stop("Invalid argument: You don't have the 'hydroGOF' package !!") } else {


Do I have to explicitly import 'ggof' and 'plot2' on the 'hydroPSO' package in order to avoid this error or is there any better solution ?

R version 2.15.0 (2012-03-30)
Platform: x86_64-redhat-linux-gnu (64-bit)

[3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8
[5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] lhs_0.7          hydroPSO_0.1-57  hydroGOF_0.3-3-1 hydroTSM_0.3-4-5
[5] xts_0.8-6        Lisflood_0.2-10  zoo_1.7-7

loaded via a namespace (and not attached):
[1] automap_1.0-12 class_7.3-4 cluster_1.14.2 e1071_1.6
grid_2.15.0 [6] gstat_1.0-12 Hmisc_3.9-3 lattice_0.20-6 proj4_1.0-7 rgdal_0.7-12 [11] sp_0.9-99 tools_2.15.0

Any help would be very much appreciated.

Kind regards,

Mauricio Zambrano-Bigiarini

Water Resources Unit
Institute for Environment and Sustainability (IES)
Joint Research Centre (JRC), European Commission
webinfo    : http://floods.jrc.ec.europa.eu/
DISCLAIMER:\ "The views expressed are purely those of th...{{dropped:11}}

R-devel_at_r-project.org mailing list
Received on Mon 02 Jul 2012 - 15:09:09 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jul 2012 - 17:10:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive