trulia / choroplethr

choroplethr simplifies the creation of choropleths (thematic maps) in R
Other
141 stars 51 forks source link

error returned when trying to map by county, but not by state #27

Closed ghost closed 10 years ago

ghost commented 10 years ago

I am getting the following error

choroplethr(df_pop_county, "county", title="2012 Population Estimates") Error in if (nrow(layer_data) == 0) return() : argument is of length zero

If I make a state level request

choroplethr(df_pop_state, "state", title="2012 Population Estimates")

It works as expected.

It appears that df_pop_county is at least initialized

head(df_pop_county) region value 1 1001 54590 2 1003 183226 3 1005 27469 4 1007 22769 5 1009 57466 6 1011 10779

I've reinstalled the choroplethr package, to no avail. I'm using a Mac OSX 10.9.4, R.Version() = $version.string [1] "R version 3.0.3 (2014-03-06)"

Note, I have a county level data set that I've created, and the following call does work as expected: choroplethr(tempDf, lod="county", num_buckets=6, states="WA", warn_na=F)

arilamstein commented 10 years ago

I have seen that error. I can't remember the exact cause, but I seem to remember that it was an issue with dependencies not matching. Can you type library() for all the packages listed in the dependencies and try again?

library(ggplot2)
library(plyr)
library(Hmisc)
library(grid)
library(acs)
library(stringr)
library(testthat)
library(maps)
library(zipcode)
library(knitr)
ghost commented 10 years ago

Hi,

Thanks for the quick response, I really appreciate it!!

That seemed like a good idea, but it didn’t fix it. I restarted R and did the sequence you provided, but I get the same error. Other functions still work.

Steven


@stevenvannoy stevenvannoy.wordpress.com

On Sep 30, 2014, at 3:38 PM, arilamstein notifications@github.com wrote:

library(ggplot2) library(plyr) library(Hmisc) library(grid) library(acs) library(stringr) library(testthat) library(maps) library(zipcode) library(knitr)

arilamstein commented 10 years ago

Hi Steve,

Please try the following:

  1. updating your version of R (the current version is 3.1.1)
  2. updating all your packages by typing update.packages()

and trying again.

I am running 3.1.1. I just uninstalled all my packages and reinstalled choroplethr and it worked fine. For reference, here is my script. Also, I am running mac os x 10.9.4 as well:

remove.packages( installed.packages( priority = "NA" )[,1] )
install.packages("choroplethr")
library(choroplethr)
data(choroplethr)
choroplethr(df_pop_county, "county", title="2012 Population Estimates")
ghost commented 10 years ago

Cool!! I was actually running 3.1.1 on my main machine but not on the secondary one. The error was being produced on both. However, the remove.packages and install.packages must have been the key, it's working now.

Thank you very much!!

Steven


@stevenvannoy stevenvannoy.wordpress.com

On Oct 1, 2014, at 12:15 AM, arilamstein notifications@github.com wrote:

Hi Steve,

Please try the following:

updating your version of R (the current version is 3.1.1) updating all your packages by typing update.packages() and trying again.

I am running 3.1.1. I just uninstalled all my packages and reinstalled choroplethr and it worked fine. For reference, here is my script. Also, I am running mac os x 10.9.4 as well:

remove.packages( installed.packages( priority = "NA" )[,1] ) install.packages("choroplethr") library(choroplethr) data(choroplethr) choroplethr(df_pop_county, "county", title="2012 Population Estimates") — Reply to this email directly or view it on GitHub.

arilamstein commented 10 years ago

Great. I'll close the ticket. Thank you for using choroplethr!