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

Reply via email to