A basic starter for UCB students who want to make a choropleth map. Nearly identical to Mike Bostock's many examples with counties.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style type="text/css"> | |
/*css to go here*/ | |
svg { | |
border: 1px solid #f0f; | |
} | |
circle { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
st | county | STATE | composite | fipstxt | FIPS | count3 | |
---|---|---|---|---|---|---|---|
AK | Aleutians East | Alaska | ak_aleutians east | 02013 | 2013 | 0 | |
AK | Aleutians West | Alaska | ak_aleutians west | 02016 | 2016 | 0 | |
AK | Anchorage | Alaska | ak_anchorage | 02020 | 2020 | 19 | |
AK | Bethel | Alaska | ak_bethel | 02050 | 2050 | 1 | |
AK | Bristol Bay | Alaska | ak_bristol bay | 02060 | 2060 | 0 | |
AK | Denali | Alaska | ak_denali | 02068 | 2068 | 0 | |
AK | Dillingham | Alaska | ak_dillingham | 02070 | 2070 | 0 | |
AK | Fairbanks North Star | Alaska | ak_fairbanks north star | 02090 | 2090 | 4 | |
AK | Haines | Alaska | ak_haines | 02100 | 2100 | 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yield | variety | year | site | |
---|---|---|---|---|
27 | Manchuria | 1931 | University Farm | |
48.86667 | Manchuria | 1931 | Waseca | |
27.43334 | Manchuria | 1931 | Morris | |
39.93333 | Manchuria | 1931 | Crookston | |
32.96667 | Manchuria | 1931 | Grand Rapids | |
28.96667 | Manchuria | 1931 | Duluth | |
43.06666 | Glabron | 1931 | University Farm | |
55.2 | Glabron | 1931 | Waseca | |
28.76667 | Glabron | 1931 | Morris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 | Manchuria | 1931 | University Farm | |
---|---|---|---|---|
48.86667 | Manchuria | 1931 | Waseca | |
27.43334 | Manchuria | 1931 | Morris | |
39.93333 | Manchuria | 1931 | Crookston | |
32.96667 | Manchuria | 1931 | Grand Rapids | |
28.96667 | Manchuria | 1931 | Duluth | |
43.06666 | Glabron | 1931 | University Farm | |
55.2 | Glabron | 1931 | Waseca | |
28.76667 | Glabron | 1931 | Morris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style type="text/css"> | |
/*css to go here*/ | |
body { | |
font-family: arial; | |
font-size: 12px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style type="text/css"> | |
/*css to go here*/ | |
.ancombe-chart { | |
border: 1px solid #f0f; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_country_data <- function(country_name) { | |
# this puts a plus instead of the space, which is how the URL behaves | |
country_name <- gsub(" ", "+", country_name) | |
#this fixes ivory coast | |
country_name <- gsub("`", "%60", country_name) | |
# first part of the url | |
first_part <- "http://adoption.state.gov/maps/statistics/map_files/statistics.php?special=NONE&year=ALL&country=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(maptools) | |
get_second_element <- function(item) { | |
return (item[2]) | |
} | |
get_first_element <- function(item) { | |
return (item[1]) | |
} |
A basic bar chart syntax, based off the example publised by the NYT in their series about ESPN.