[R-pkg-devel] “unable to find an inherited method” error in choroplethr package

arilamstein at gmail.com arilamstein at gmail.com
Wed Mar 30 18:55:28 CEST 2016


Uwe,

Based on what you report, it seems at least possible that the bug is
related to some changes in R between versions.

I just submitted an updated version of the package to CRAN that moves the
acs package from "import" to "depends'. This solves the problem because it
forces users to load the acs package whenever they use the choroplethr
package. This is the solution that I was hoping to avoid (it seems like
overkill to me), but it will at least allow me to distribute a version of
my package where all the functions work.

Ari

On Mon, Mar 28, 2016 at 2:07 PM, <arilamstein at gmail.com> wrote:

> I am using R 3.2.4 for mac. Here is my sessionInfo():
>
> > sessionInfo()
> R version 3.2.4 (2016-03-10)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.10.5 (Yosemite)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] choroplethr_3.5.1 XML_3.98-1.4      plyr_1.8.3        stringr_1.0.0
>
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.4         RColorBrewer_1.1-2  bitops_1.0-6
>  tools_3.2.4
>  [5] rpart_4.1-10        gtable_0.2.0        lattice_0.20-33     png_0.1-7
>
>  [9] WDI_2.4             DBI_0.3.1           mapproj_1.2-4
> parallel_3.2.4
> [13] proto_0.3-10        gridExtra_2.2.1     dplyr_0.4.3
> cluster_2.0.3
> [17] maps_3.1.0          RgoogleMaps_1.2.0.7 grid_3.2.4
>  nnet_7.3-12
> [21] R6_2.1.2            jpeg_0.1-8          survival_2.38-3
> foreign_0.8-66
> [25] RJSONIO_1.3-0       sp_1.1-1            ggmap_2.6.1
> latticeExtra_0.6-28
> [29] Formula_1.2-1       reshape2_1.4.1      ggplot2_2.1.0
> magrittr_1.5
> [33] Hmisc_3.17-2        scales_0.4.0        acs_2.0
> splines_3.2.4
> [37] assertthat_0.1      colorspace_1.2-6    geosphere_1.5-1
> stringi_1.0-1
> [41] acepack_1.3-3.3     RCurl_1.95-4.8      munsell_0.4.3
> rjson_0.2.15
> >
>
> On Mon, Mar 28, 2016 at 2:01 PM, Uwe Ligges <
> ligges at statistik.tu-dortmund.de> wrote:
>
>> I just tried your code with acs 2.0 and choroplethr 3.5.1 under R-3.3.0
>> alpha and got a result rather than an error...
>>
>> Are you using a different version of anything?
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>> On 28.03.2016 22:49, arilamstein at gmail.com wrote:
>>
>>> Unfortunately I am still getting the same error:
>>>
>>> install.packages(c("choroplethr", "acs"))
>>> library(acs)
>>> api.key.install("f8b2a6df01479981aef39577b3c4466f5a4c8274")
>>> detach("package:acs", unload=TRUE)
>>>
>>> library(choroplethr)
>>> get_state_demographics()
>>> Error in (function (classes, fdef, mtable)  :
>>>              unable to find an inherited method for function ‘geography’
>>> for signature ‘"matrix"’
>>>
>>> Someone suggested that I import the acs class in my NAMESPACE. But even
>>> after adding:
>>>
>>> importClassesFrom(acs,acs)
>>>
>>> I get the same error.
>>>
>>>
>>> On Sun, Mar 27, 2016 at 11:52 AM, Uwe Ligges
>>> <ligges at statistik.tu-dortmund.de
>>> <mailto:ligges at statistik.tu-dortmund.de>> wrote:
>>>
>>>     Has this been resolved now?
>>>
>>>     I cannot reproduce the problem as I get:
>>>
>>>      > library(choroplethr)
>>>      >
>>>      > ?get_state_demographics
>>>     starting httpd help server ... done
>>>     >
>>>     > get_state_demographics()
>>>     Error in (function (classes, fdef, mtable)  :
>>>        unable to find an inherited method for function ‘geography’ for
>>>     signature ‘"logical"’
>>>     In addition: Warning message:
>>>     In acs::acs.fetch(geography = state_geo, table.number = "B03002",  :
>>>        'key' required to access Census API site for download;
>>>        See http://www.census.gov/developers/ to request a key
>>>        and/or use 'key=' (or run 'api.key.install()') to avoid this
>>> error.
>>>
>>>
>>>     Best,
>>>     Uwe Ligges
>>>
>>>
>>>
>>>     On 25.03.2016 21 <tel:25.03.2016%2021>:55, arilamstein at gmail.com
>>>
>>>     <mailto:arilamstein at gmail.com> wrote:
>>>
>>>         Recently the functionality in the choroplethr
>>>         <https://cran.r-project.org/web/packages/choroplethr/index.html>
>>>         package
>>>         that depends on the acs
>>>         <https://cran.r-project.org/web/packages/acs/index.html>
>>> package has
>>>         stopped working. I've been able to narrow down the cause, but
>>>         cannot figure
>>>         out how to fix it. Any help would be appreciated. To reproduce
>>>         the error
>>>         you can type:
>>>
>>>         install.packages("choroplethr")
>>>
>>>         library(choroplethr)
>>>
>>>         ?get_state_demographics
>>>
>>>         get_state_demographics()
>>>
>>>         Error in (function (classes, fdef, mtable)  :
>>>
>>>         unable to find an inherited method for function ‘geography’ for
>>>         signature
>>>         "matrix"’
>>>
>>>         (Note: you will need to set a census API key for this example to
>>>         "work".
>>>         See here
>>>         <
>>> https://cran.r-project.org/web/packages/choroplethr/vignettes/e-mapping-us-census-data.html
>>> >
>>>         for instructions).
>>>
>>>         I believe that this error was introduced by version 2.0 of the
>>>         acs package,
>>>         which was just released. I suspect that choroplethr is either
>>>         not importing
>>>         something that it should be importing, or acs is not exporting
>>>         something
>>>         that it should be exporting. For example, the problem can be
>>>         fixed by
>>>         simply loading the acs package first:
>>>
>>>         library(acs)
>>>
>>>         get_state_demographics()
>>>
>>>         <valid result>
>>>
>>>         The acs package uses both S3 and S4, which I do not have much
>>>         experience
>>>         with. I have been reading Hadley's excellent chapter on
>>> Namespaces
>>>         <http://r-pkgs.had.co.nz/namespace.html>, and tweaked various
>>> import
>>>         directives in the choroplethr package (the actual code that
>>>         crashes is here
>>>         <
>>> https://github.com/arilamstein/choroplethr/blob/master/R/get_state_demograhpics.R#L42
>>> >).
>>>         But I am still not sure how to fix this problem.. Any help would
>>> be
>>>         appreciated.
>>>
>>>                  [[alternative HTML version deleted]]
>>>
>>>         ______________________________________________
>>>         R-package-devel at r-project.org
>>>         <mailto:R-package-devel at r-project.org> mailing list
>>>         https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>
>>>
>>>
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list