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

arilamstein at gmail.com arilamstein at gmail.com
Mon Mar 28 22:49:23 CEST 2016


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> 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:55, 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 mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list