Skip to content

Instantly share code, notes, and snippets.

@kbroman
Last active March 21, 2019 00:35
Show Gist options
  • Save kbroman/bfba63a490fb40ea907a79e1ddd2354f to your computer and use it in GitHub Desktop.
Save kbroman/bfba63a490fb40ea907a79e1ddd2354f to your computer and use it in GitHub Desktop.
low-res picture of me in legos, rendered via the brickr package
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 1 column, instead of 40 in line 7.
# 1 = white
# 2 = gray [3]
# 3 = dark gray [4]
# 4 = light blue [13 or 21]
# 5 = bright blue [6]
# 6 = dark blue [27 or 23]
# 7 = black [2]
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,2,2,4,4,4,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,4,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,4,2,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,2,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1,1
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6,6,6,6,6,6,5,3,3,3,7,6,7,6,6,4
1,1,1,1,1,1,1,1,1,1,1,1,1,3,7,3,1,2,3,5,5,5,6,6,6,6,6,6,6,5,3,3,3,3,7,6,7,6,6,6
1,1,1,1,1,1,1,1,1,1,1,1,4,7,7,5,1,1,2,4,3,5,6,6,6,6,6,6,5,3,3,3,3,3,6,6,7,6,6,6
1,1,1,1,1,1,1,1,1,1,1,1,5,7,7,6,4,1,1,2,2,4,3,3,5,5,5,3,3,3,4,4,4,2,7,6,7,6,6,6
1,1,1,1,1,1,1,1,1,1,1,2,6,7,7,7,5,2,1,1,2,2,2,2,2,4,4,4,4,4,4,4,4,6,6,6,7,6,6,6
1,1,1,1,1,1,1,1,1,1,3,6,6,7,7,7,6,4,1,1,1,1,1,2,2,2,2,4,4,2,2,2,3,7,6,6,7,6,6,6
1,1,1,1,1,1,1,1,1,3,7,6,6,7,7,7,7,5,2,1,1,1,1,1,1,2,2,2,2,2,2,4,7,7,6,7,6,6,6,6
1,1,1,1,1,1,1,1,1,6,6,6,7,7,7,7,7,7,3,1,1,1,1,1,1,1,2,2,1,1,4,7,7,7,6,7,6,6,7,7
# install_github("ryantimpe/brickr")
# install_github("tylermorganwall/rayshader")
library(brickr) # also need rayshader
url <- paste0("https://gist.githubusercontent.com/kbroman/",
"bfba63a490fb40ea907a79e1ddd2354f/",
"raw/8c3a3d82423956867bc31f0f0980f7c887badff1/",
"karl_lego.csv")
file <- basename(url)
if(!file.exists(file)) download.file(url, file)
x <- read.csv(file, comment.char="#", header=FALSE)
# revise the numbers, to change the colors
renumber <- data.frame(old=c(2,3,4,5,6,7),new=c(3,4,21,6,23,2))
karl <- x
for(i in 1:nrow(renumber)) {
karl[x==renumber$old[i]] <- renumber$new[i]
}
karl <- cbind(level="A", karl)
karl %>%
bricks_from_table() %>%
display_bricks()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment