diff --git a/R/statebins.R b/R/statebins.R index de10a48..dccc4c4 100644 --- a/R/statebins.R +++ b/R/statebins.R @@ -42,7 +42,7 @@ statebins <- function(state_data, state_col="state", value_col="value", gg <- ggplot(st.dat, aes(x=col, y=row, label=abbrev)) gg <- gg + geom_tile(aes(fill=fill_color)) gg <- gg + geom_tile(color=state_border_col, aes(fill=fill_color), size=3, show_guide=FALSE) - gg <- gg + geom_text(color=text_color) + gg <- gg + geom_text(color=text_color, size=2) gg <- gg + scale_y_reverse() gg <- gg + scale_fill_brewer(palette=brewer_pal, name=legend_title) gg <- gg + coord_equal() @@ -112,7 +112,7 @@ statebins_continuous <- function(state_data, state_col="state", value_col="value gg <- gg + geom_tile(aes_string(fill=value_col)) gg <- gg + geom_tile(color=state_border_col, aes_string(fill=value_col), size=3, show_guide=FALSE) - gg <- gg + geom_text(color=text_color) + gg <- gg + geom_text(color=text_color, size=2) gg <- gg + scale_y_reverse() gg <- gg + continuous_scale("fill", "distiller", gradient_n_pal(brewer_pal(type, brewer_pal)(6), NULL, "Lab"), na.value = "grey50", name=legend_title) diff --git a/_README.md b/_README.md new file mode 100644 index 0000000..719ae03 --- /dev/null +++ b/_README.md @@ -0,0 +1,75 @@ +statesquares is ... + +The following functions are implemented: + +- `statebins` - + +### News + +- Version `1.0.0` released + +### Installation + +``` {.r} +devtools::install_github("hrbrmstr/statebins") +``` + +### Usage + +``` {.r} +library(statebins) +``` + + ## Loading required package: ggplot2 + ## Loading required package: grid + ## Loading required package: scales + ## Loading required package: gridExtra + +``` {.r} +# current verison +packageVersion("statebins") +``` + + ## [1] '1.0' + +``` {.r} +dat <- read.csv("http://www.washingtonpost.com/wp-srv/special/business/states-most-threatened-by-trade/states.csv?cache=1", stringsAsFactors=FALSE) + +gg <- statebins(dat, "state", "avgshare94_00", breaks=4, + labels=c("0-1", "1-2", "2-3", "3-4"), + legend_title="State Groups", + brewer_pal="Blues", text_color="black", + plot_title="1994-2000", title_position="bottom") + +gg +``` + +![plot of chunk unnamed-chunk-3](./_README_files/figure-markdown_github/unnamed-chunk-31.png) + +``` {.r} +gg2 <- statebins_continuous(dat, "state", "avgshare01_07", + legend_title="States", legend_position="none", + brewer_pal="OrRd", text_color="black", + plot_title="1994-2000", title_position="bottom") + +gg2 +``` + +![plot of chunk unnamed-chunk-3](./_README_files/figure-markdown_github/unnamed-chunk-32.png) + +### Test Results + +``` {.r} +library(statebins) +library(testthat) + +date() +``` + + ## [1] "Mon Aug 25 22:22:55 2014" + +``` {.r} +test_dir("tests/") +``` + + ## basic functionality : diff --git a/_README_files/figure-markdown_github/unnamed-chunk-31.png b/_README_files/figure-markdown_github/unnamed-chunk-31.png index dba2571..87aa632 100644 Binary files a/_README_files/figure-markdown_github/unnamed-chunk-31.png and b/_README_files/figure-markdown_github/unnamed-chunk-31.png differ diff --git a/_README_files/figure-markdown_github/unnamed-chunk-32.png b/_README_files/figure-markdown_github/unnamed-chunk-32.png index f4314d9..c339fcb 100644 Binary files a/_README_files/figure-markdown_github/unnamed-chunk-32.png and b/_README_files/figure-markdown_github/unnamed-chunk-32.png differ