using a tbl_df type (as generated by the dplyr package) causes an error
Created by: drolejoel
see http://stackoverflow.com/a/28122695/1273199
I get the error message "Error: state_data[, state_col] %in% state_coords[, merge.x] is not TRUE" when the data.frame is wrapped by the tbl_df class.
library(statebins)
t <- read.table(text= "year value state 2008 55.50628 Alabama 2008 67.52304 Alaska 2008 70.94418 Arizona 2008 57.89743 Arkansas 2008 71.40450 California 2008 75.29866 Colorado 2008 73.13052 Connecticut 2008 74.69418 Delaware", header=TRUE, stringsAsFactors=FALSE)
class(t) # data.frame statebins(t, state_col = "state", value_col = "value") # results in a statebins map
library(dplyr) # now repeat with tbl_df
t <- tbl_df(t) # convert to a tbl_df type class(t) # "tbl_df" "tbl" "data.frame" statebins(t, state_col = "state", value_col = "value") # yields this error message: "Error: state_data[, state_col] %in% state_coords[, merge.x] is not TRUE"