The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
# pkgs | |
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
## add_logo function from Thomas Mock | |
add_logo <- function(plot_path, logo_path, logo_position, logo_scale = 10){ | |
# Requires magick R Package https://github.com/ropensci/magick |
## Start with the code in https://github.com/kjhealy/lexis_surface/blob/master/lexis.r | |
## At the bottom, the `fra_surface` object is done in 3D with the `plotly` library. We can | |
## also do it with `rayshade`: | |
library(rayshader) | |
## rayshade wants the axes a little differently from plotly | |
## but like plotly it wants a matrix. | |
fra_surf <- fra_surf[c(1:201),c(100:1)] |
# Animated dplyr joins with gganimate | |
# * Garrick Aden-Buie | |
# * garrickadenbuie.com | |
# * MIT License: https://opensource.org/licenses/MIT | |
# Note: I used Fira Sans and Fira Mono fonts. | |
# Use search and replace to use a different font if Fira is not available. | |
library(tidyverse) | |
library(gganimate) |
library(XML) | |
library(ggplot2) | |
df <- readHTMLTable("http://projects.dailycal.org/paychecker")[[1]] | |
colnames(df)[4] <- "Salary" | |
df$Salary <- as.numeric(gsub('[$,]', '', df$Salary)) | |
p <- ggplot(df, aes(x=Department, y=Salary)) + coord_flip() | |
p + geom_boxplot(aes(color=Rank, | |
x=reorder(Department, Salary, FUN=max))) + |
library(XML) | |
library(ggplot2) | |
df <- readHTMLTable("http://projects.dailycal.org/paychecker/departments/")[[1]] | |
DeMoney <- function(x) as.numeric(gsub(",", "", gsub("\\$", "", as.character(x)))) | |
money.columns <- c("All", "Professor", "Associate professor", "Assistant professor", | |
"Lecturer") |
## Lehmann, Schwartz, and Hansen (2008) | |
## For use with igraph objects | |
## via http://stackoverflow.com/questions/31024481/detect-bi-cliques-in-r-for-bipartite-graph | |
library(igraph) | |
computeBicliques <- function(graph, k, l) { | |
vMode1 <- c() | |
if (!is.null(V(graph)$type)) { |
The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
title: Lorem Ipsum author:
### From Rmd to PDF or html | |
## All Rmarkdown files in the working directory | |
SRC = $(wildcard *.Rmd) | |
## Location of Pandoc support files. | |
PREFIX = /Users/kjhealy/.pandoc | |
## Location of your working bibliography file | |
BIB = /Users/kjhealy/Documents/bibs/socbib-pandoc.bib |
I hereby claim:
To claim this, I am signing this object: