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
#Recreation Thursday | |
# August 26, 2021 | |
#https://twitter.com/kelsey_chalmers/status/1430875667793682432?s=20 | |
library(tidyverse) | |
library(scales) | |
scale_dims = 10 | |
scale_pattern = 1.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
#Recreation Thursday | |
# August 12, 2021 | |
library(tidyverse) | |
library(ggforce) | |
library(scales) | |
n_x = 13 #Number of circles along bottom X | |
n_y = 19 #Number of circles along side Y |
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
#Only two big differences... | |
# Swap out brickr::lego_colors for lego_colors on line 57 | |
# added brickr::: to collect_bricks() on line 89 | |
bricks_from_coords_w_custom_colors <- function(coord_table, | |
use_bricks = NULL, | |
increment_level = 0, min_level = 1, max_level = Inf, | |
increment_x = 0, max_x = Inf, | |
increment_y = 0, max_y = Inf, | |
exclude_color = NULL, exclude_level = NULL){ |
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
#Reproduce this prime factorization poster in R | |
#https://twitter.com/stevenstrogatz/status/1295915404574040065?s=20 | |
library(tidyverse) | |
#Prime factorization function from SO | |
# https://stackoverflow.com/questions/49974601/r-prime-factorization | |
get_prime_factors = function(x){ | |
n=c() | |
i=2 |
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
#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) |
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
# 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"))) |
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(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() |
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(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, |
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(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", |
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(brickr) | |
#This is a brick | |
brick <- data.frame( | |
Level="A", | |
X1 = rep(1,4), | |
X2 = rep(1,4) | |
) | |
brick %>% |
NewerOlder