Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Timpe ryantimpe

View GitHub Profile
@ryantimpe
ryantimpe / cabinfever2.R
Created Apr 13, 2020
flametree & brickr
View cabinfever2.R
#Adapted from Jacqueline Nolis' project
# https://gist.github.com/jnolis/045403c4aa5e9b28e82d1c83b3dfe9ef
# remotes::install_github("djnavarro/flametree")
library(flametree)
library(brickr)
library(ggplot2)
library(png)
library(dplyr)
@ryantimpe
ryantimpe / brickr_0p3_releasevideo.R
Last active Apr 7, 2020
{brickr} 0.3 Release Video
View brickr_0p3_releasevideo.R
# install.packages("brickr")
library(brickr)
library(rgl)
library(httr)
#Render static model ----
GET("http://www.ryantimpe.com/files/brickr_release3.xlsx",
write_disk(tf <- tempfile(fileext = ".xlsx")))
@ryantimpe
ryantimpe / babyyoda.R
Last active Mar 5, 2020
brickr_BabyYoda
View babyyoda.R
library(dplyr)
library(brickr)
library(rgl)
library(httr)
#Render a static model
GET("http://www.ryantimpe.com/files/babyyoda.xlsx", write_disk(tf <- tempfile(fileext = ".xlsx")))
babyyoda <- readxl::read_xlsx(tf, sheet = "BabyYoda") %>%
bricks_from_excel()
@ryantimpe
ryantimpe / brickr_Ex3_RandomForest.R
Created Mar 22, 2019
{brickr} Example - Random Forest
View brickr_Ex3_RandomForest.R
library(tidyverse)
library(brickr)
display_colors()
random_tree <- function(xloc, yloc, height, radius){
startz <- round(height * (2/5))
#Build a 3x3 trunk
trunk_coords <- expand.grid( x = -1:1, y = -1:1,
@ryantimpe
ryantimpe / brickr_Ex2_Owl.R
Created Mar 15, 2019
{brickr} Example - Build an owl
View brickr_Ex2_Owl.R
library(brickr)
source(brickr_Owl_design.R)
#Remind me of the color names again...
display_colors()
#Use those names in the Color column
owl_colors <- tibble::tribble(
~.value, ~Color,
1, "Bright orange",
@ryantimpe
ryantimpe / brickr_Ex1.R
Created Mar 15, 2019
{brickr} Getting Started
View brickr_Ex1.R
library(brickr)
#This is a brick
brick <- data.frame(
Level="A",
X1 = rep(1,4),
X2 = rep(1,4)
)
brick %>%
@ryantimpe
ryantimpe / TurkeyVelociraptorPlot.R
Last active Nov 25, 2018
Plot phylopic images to compare raptor size in Jurassic Park to reality
View TurkeyVelociraptorPlot.R
library(tidyverse); library(rvest);
library(png)
#Phylopic images here:
https://github.com/ryantimpe/ChartOfTheDay/tree/master/data
#Text wrapping function ---
wrapper <- function(x, ...) {paste(strwrap(x, ...), collapse = "\n")}
#Scale image into feet
You can’t perform that action at this time.