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

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Mar 28 23:01:41 CEST 2016


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
>
>



More information about the R-package-devel mailing list