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
border: no | |
height: 333 | |
license: CC0-1.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
license: gpl-3.0 | |
height: 600 |
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(ggplot2) ## devtools::install_github("hadley/ggplot2) | |
library(grid) ## rasterGrob | |
library(EBImage) ## readImage (alternatively: magick::image_read) | |
library(ggthemes) ## theme_minimal | |
## ########## | |
## INDEPENDENT CODE TO BE SOURCED: | |
## ########## | |
# user-level interface to the element grob |
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
#' Replace categorical x-axis labels with images | |
#' | |
#' Pipe a ggplot2 graph (with categorical x-axis) into this function with the argument of a list of | |
#' pictures (e.g. loaded via readImage) and it builds a new grob with the x-axis categories | |
#' now labelled by the images. Solves a problem that you perhaps shouldn't have. | |
#' | |
#' @author J. Carroll, \email{jono@@jcarroll.com.au} | |
#' @references \url{http://stackoverflow.com/questions/29939447/icons-as-x-axis-labels-in-r-ggplot2} | |
#' | |
#' @param g ggplot graph with categorical x axis |

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
############ | |
# Option 1: Get all solutions | |
# using brute force | |
############ | |
## This function creates every possible distribution of responses for | |
## a likert scale with nlev responses. This is total brute force. There's | |
## probably a better way. | |
## Argument: | |
## v : initially, the total number of responses |
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
source("http://bioconductor.org/biocLite.R") | |
biocLite("genomes") | |
library(genomes) | |
library(ggplot2) | |
valid <- c("released", "created", "submitted") | |
data(proks) | |
update(proks) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 29 columns, instead of 13 in line 6.
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
Cities1 Birmingham Boston Buffalo Chicago Cleveland Dallas Denver Detroit El Paso Houston Indianapolis Kansas City Los Angeles Louisville Memphis Miami Minneapolis New Orleans New York Omaha Philadelphia Phoenix Pittsburgh St. Louis Salt Lake City San Francisco Seattle Washington | |
Birmingham, Ala. — 1194 947 657 734 653 1318 754 1278 692 492 703 2078 378 249 777 1067 347 983 907 894 1680 792 508 1805 2385 2612 751 | |
Boston, Mass. 1194 — 457 983 639 1815 1991 702 2358 1886 940 1427 3036 996 1345 1539 1402 1541 213 1458 304 2664 597 1179 2425 3179 3043 440 | |
Buffalo, N.Y. 947 457 — 536 192 1387 1561 252 1928 1532 510 997 2606 571 965 1445 955 1294 436 1011 383 2234 219 749 1978 2732 2596 386 | |
Chicago, Ill. 657 983 536 — 344 931 1050 279 1439 1092 189 503 2112 305 546 1390 411 947 840 493 758 1729 457 293 1458 2212 2052 695 | |
Cleveland, Ohio 734 639 192 344 — 1205 1369 175 1746 1358 318 815 2424 379 773 1325 763 1102 514 819 432 2052 131 567 1786 2540 2404 369 | |
Dallas, Tex. 653 1815 1387 931 1205 — 801 1167 625 242 877 5 |
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
license: gpl-3.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
# Helper functions that allow string arguments for dplyr's data modification functions like arrange, select etc. | |
# Author: Sebastian Kranz | |
# Examples are below | |
#' Modified version of dplyr's filter that uses string arguments | |
#' @export | |
s_filter = function(.data, ...) { | |
eval.string.dplyr(.data,"filter", ...) | |
} |