From hadley at rice.edu  Fri Dec 23 20:52:57 2011
From: hadley at rice.edu (Hadley Wickham)
Date: Fri, 23 Dec 2011 13:52:57 -0600
Subject: [Rd] Debugging namespace problems
In-Reply-To: <CABdHhvFG-3g5UFps-sn_wvaK_HKgeyhY1=8WNQ84H5sYVvL1ww@mail.gmail.com>
References: <CABdHhvFG-3g5UFps-sn_wvaK_HKgeyhY1=8WNQ84H5sYVvL1ww@mail.gmail.com>
Message-ID: <CABdHhvHr90tFo15yEWpVaw-XEpc0=SJ9NOAESN99LmK36D4t8Q@mail.gmail.com>

I should add that I'm pretty sure this is something wrong with the
ggplot2 NAMESPACE because if I explicitly attach ggplot2 the code
works:

> library(nstest)
> my_plot()
Error in UseMethod("scale_dimension") :
  no applicable method for 'scale_dimension' applied to an object of
class "NULL"
> library(ggplot2)
> my_plot()
# Plot appears.

Hadley

On Fri, Dec 23, 2011 at 1:50 PM, Hadley Wickham <hadley at rice.edu> wrote:
> Hi all,
>
> I frequently find that I've failed to export something in my NAMESPACE
> and hence my package doesn't work when it's imported into another
> package. Does anyone have suggestion for debugging this type of
> problem? ?R CMD check passes without any ns related errors on both the
> importee and the importer.
>
> I've attached a reproducible example - if you install the development
> version of ggplot2 (e.g. with devtools::install_github("ggplot2") the
> attached package fails R CMD check with:
>
>> ### ** Examples
>>
>> plot(my_plot())
> Error in structure(list(data = data, layers = list(), scales = Scales$new(), ?:
> ?attempt to apply non-function
> Calls: plot ... my_plot -> ggplot -> ggplot.data.frame -> structure
> Execution halted
> Error: Command failed (1)
>
> Hadley
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



[Rd] Debugging namespace problems
Hadley Wickham