choroplethr

Assigning colors to table values using Choroplethr

非 Y 不嫁゛ 提交于 2021-01-28 19:44:16
问题 I'm trying to use choroplethr to make a map at the county level. Currently, I have 3 categorical integers (1, 2, 3) in my csv under the column value which vary depending on each county. The region column contains county fips. I want to display the following values as the respective label , color (value = label = color): 0 = "None" = "white", 1 = "MD" = "#64acbe", 2 = "DO" = "#c85a5a", 3 = "Both" = "#574249", I've tried several combinations of scale_fill_brewer without the results I'm looking

Trouble with get_tract_map function in R choroplthr

纵然是瞬间 提交于 2020-01-05 08:49:26
问题 I've just installed the new Choroplethr v3.6.0 and am using Ari Lamstein's blog tutorial to practice, as well as learning R, so I'm still learning to read errors. All the example code works for me, but when I try substituting "georgia" for "new york" I get an error: Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open layer In addition: Warning message: In unzip(file_loc, exdir = cache_dir, overwrite = TRUE) : error 1 in extracting from zip file

Is there a way that I can manually control the thresholds between various range on choroplethr?

久未见 提交于 2020-01-03 02:22:13
问题 I would like to be able to manually control the thresholds between population ranges on choroplethr package. library(choroplethr) data(df_pop_county) data(continental_us_states) county_choropleth(df_pop_county, state_zoom = continental_us_states) 回答1: You can use cut to create the custom breaks: # rename the original "value" column if you don't want to write over it names(df_pop_county) <- c("region", "original_value") # define the breaks you want df_pop_county$value <- cut(df_pop_county[[

Counties within One State Choropleth Map

为君一笑 提交于 2019-12-12 12:57:55
问题 I'm struggling to customize and find the right code to structure the choropleth map that I am attempting to make of profit of a business by county in a specific state. What I have done so far is be able to plot my code, albeit with a color palette that I don't want and breaks that are undesirable as well. library(choroplethr) library(ggplot2) county <- data.frame(region = c(19001,19013,19017,19019,19021,19023,19033,19035), value=c(-37102,-41052,35016,-13180,-8062,6357,-46946,-5380)) county

Alaska and Hawaii not formatting correctly for County Choropleth Map in R

大兔子大兔子 提交于 2019-12-12 10:38:19
问题 I am trying to format a Choropleth Map of the United States to a specific color and unfortunately, when using scale_fill_brewer to change the color; only 48 of the states do (Hawaii and Alaska do not). Is it possible to know if I can implement the coloring to Hawaii and Alaska as well? library(choroplethr) library(choroplethrMaps) library(ggplot2) data(df_pop_county) county_choropleth(df_pop_county, title = "Title1", legend = "Top 20% of Index", num_colors = 9) + geom_polygon(aes(fill=value),

tract_choropleth in Choroplethr v3.6.0 for R

人盡茶涼 提交于 2019-12-11 06:20:12
问题 I'm trying to replicate the maps shown in this short example (Choroplethr v3.6.0 is now on CRAN) for California, but I'm having trouble with the tract_choropleth function for areas that are not in NY. I get the error message below. I'm able to import the underlying tract data for all areas, but I'm having trouble mapping the non-NY ones. Thanks in advance. # Load all packages (DONE) # Install api key (DONE) # Get Tract-Level Demographics ca_stats = get_tract_demographics("california") #

Is there a way that I can manually control the thresholds between various range on choroplethr?

丶灬走出姿态 提交于 2019-12-06 16:43:20
I would like to be able to manually control the thresholds between population ranges on choroplethr package. library(choroplethr) data(df_pop_county) data(continental_us_states) county_choropleth(df_pop_county, state_zoom = continental_us_states) You can use cut to create the custom breaks: # rename the original "value" column if you don't want to write over it names(df_pop_county) <- c("region", "original_value") # define the breaks you want df_pop_county$value <- cut(df_pop_county[["original_value"]], breaks = c(0, 1e4, 5e4, 1e5, 5e5, 1e6, 1e7)) # if you want custom labels to go along with

setting breaks and labels in ggplot

倾然丶 夕夏残阳落幕 提交于 2019-12-01 18:00:44
I have put together the Shiny app (below), showing a choropleth, which looks good except for the scientific notation on the legend. I would like the values to read: '$5,000,000', and '$4,000,000', etc, etc. The code boils down to g <-choroplethr(DF, lod="state", num_buckets = 1) g <- g + scale_fill_gradient(high = "springgreen4", low= "grey90", name="Sum") I attempted this: g <- q + scale_fill_gradient(high = "springgreen4", low= "grey90", name="Sum", labels = c("5,000,000", "4,000,000", "3,000,000", "2,000,000", "1,000,000")) But I got the error, Breaks and labels are different lengths I'm

setting breaks and labels in ggplot

你说的曾经没有我的故事 提交于 2019-12-01 02:23:05
问题 I have put together the Shiny app (below), showing a choropleth, which looks good except for the scientific notation on the legend. I would like the values to read: '$5,000,000', and '$4,000,000', etc, etc. The code boils down to g <-choroplethr(DF, lod="state", num_buckets = 1) g <- g + scale_fill_gradient(high = "springgreen4", low= "grey90", name="Sum") I attempted this: g <- q + scale_fill_gradient(high = "springgreen4", low= "grey90", name="Sum", labels = c("5,000,000", "4,000,000", "3

Making a zip code choropleth in R using ggplot2 and ggmap

女生的网名这么多〃 提交于 2019-11-27 14:41:27
问题 I am trying to make a choropleth of very simple data, and it's kind of a pain in the neck. I have the following zip codes in the Eastern USA. This is made up data but you get the idea. Zip Freq 11101 10 10014 15 11238 400 etc. for about 100 rows. Values of Freq range from 0-1000, and these are the ones I would like to use to determine the color of each zipcode. I would ideally also like the map to focus on the Eastern USA instead of the whole country. I want to make a choropleth with this