--- title: "yarrr package guide" author: "Nathaniel Phillips (nathaniel.d.phillips.is@gmail.com)" date: "`r Sys.Date()`" csl: apa.csl bibliography: yarrr.bib output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Package guide} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- # YaRrr! The pirate's guide to R This package contains data, functions, and other random files for the e-book YaRrr! The pirate's guide to R. You can access the latest version of the book at [www.thepiratesguidetor.com](www.thepiratesguidetor.com). # Guides To see guides for the main functions, click one of the following links: - [pirateplot() - A function for creating "Pirate Plots"](pirateplot.html) - [piratepal() - A function to create pirate-y color palettes](piratepal.html) # Examples ## pirateplot() The pirateplot() function creates a pirateplot ```{r, echo = F, message = F, results = 'hide'} library(yarrr) ``` ```{r, fig.width = 6, fig.height = 6, fig.align='center'} pirateplot( formula = weight ~ Time, data = ChickWeight, main = "Chicken weights by Time (week)" ) ``` ## piratepal() The `piratepal()` function returns different color palettes either created by graphic designers, or inspired by random things I have found around my office `piratepal("espresso")`, or horror movies `piratepal("evildead)"`. Here are all of the palettes: ```{r, fig.width = 6, fig.height = 6, fig.align = 'center'} piratepal("all") ``` You can then use specific palettes in your plots by specifying the named palette. I'll create a scatterplot using the google palette with `piratepal('google', trans = .5)`: ```{r, fig.width = 6, fig.height = 6, fig.align = 'center'} my.cols <- piratepal( palette = "google", trans = .5 ) set.seed(100) # For reproducibility x <- rnorm(100) y <- x + rnorm(100) plot( x = x, y = y, col = my.cols, pch = 16, cex = runif(100, min = 0, max = 2), main = "piratepal('google', trans = .5)" ) ``` # Questions If you have any questions, comments, or suggestions, write me at nathaniel.d.phillips.is@gmail.com ### References