ramnathv/rMaps

range of numbers renders lowest number in black?

Opened this issue · 1 comments

the lowest number in a series does not render in the color, but is being rendered as a black option. Example using data from FRED, and subsetting for 2012 will render North Dakota as black and not part of the blue color scheme. The same thing happens with the lowest overall number in the animate function?

library(lubridate)
library(dplyr)
library(rMaps)
#### get the data from FRED
state = state.abb
base = "http://research.stlouisfed.org/fred2/data/"
end = "UR.txt"
# put loop for all 50 states and create master list of all downloads
ui <- lapply(state, function(.st) {
  state = paste0(.st)
  input <- read.table(paste0(base, .st, end), skip=11, header=TRUE, as.is=TRUE)
  input$state = state
  # input$DATE <- as.Date(input$DATE, "%Y-%m-%d")

  input
})

ui_all <- do.call(rbind, ui)

ui_all <- 
            mutate(ui_all, year = year(ui_all$DATE), value = VALUE) %.%
            filter(year > 2006)  %.%
            select(state,  value,  year) %.%
            group_by( state, year) %.%
            summarise(avg = round(mean(value, na.rm=TRUE), digits =2))

#### create maps using the rMaps package for a test
ichoropleth(avg ~ state, data = subset(ui_all, year == 2012))
ichorolpleth(avg ~ state, data = ui_all, animate = 'year', play = TRUE

This is a bug in this line. I need to pass the argument include.lowest = TRUE to cut so that the lowest values are also included. Thanks for reporting the bug.