Skip to content
Resources and shared example for {brickr} R package
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples_Animations Updated Excel template and examples for Brickr 0.1 version Aug 29, 2019
Examples_Models Stranger Things example May 18, 2019
README_files/figure-gfm brickr Starter Kit to help new users get started with package. Apr 10, 2019
man brickr Starter Kit to help new users get started with package. Apr 10, 2019
.gitignore Updated Excel template and examples for Brickr 0.1 version Aug 29, 2019
README.Rmd
README.md Updated Excel template and examples for Brickr 0.1 version Aug 29, 2019
brickr_StarterKit.R
brickr_StarterKit.xlsx Updated Excel template and examples for Brickr 0.1 version Aug 29, 2019

README.md

LEGO Mosaics in R

brickr Toy Box

Overview

brickr is a package for creating LEGO-esque 2D and 3D models using the R tidyverse and Tyler Morgan-Wall’s rayshader package.

This repository contains templates and examples to help user get started using the package!

brickr

The brickr package has three key uses:

  • Converting image files in to 2D and 3D LEGO mosaics
  • Building 3D LEGO models from simple data frames
  • Brick bar charts in ggplot

Installation

# To install the latest version from Github:
# install.packages("devtools")
devtools::install_github("ryantimpe/brickr")

#For 3D features, rayshader is also required.
install.packages("rayshader")

#For the start kit, readxl is required.
install.packages("readxl")

Starter Kit

The Excel file “brickr_StartKit.xlsx” provides templates, as well as a How-To manual and examples, for laying out models in Excel and then rendering them as 3D models in R using brickr.

  • Lay out a model and the color key in Excel using one of the template or examples provided in the file.
  • Import the Excel sheet into R as a data frame using Jenny Bryan’s readxl package.
  • Convert this data frame into a brickr object using bricks_from_excel().
penguin <- readxl::read_xlsx("brickr_StarterKit.xlsx", sheet = "Set_Penguin")

penguin %>% 
  bricks_from_excel() %>% 
  build_bricks(theta = 155, phi = 10)

rayshader::render_snapshot()

Contribute

Please feel free to contribute your own examples into any of the “Examples_” folders by submitting a pull request!

Other Examples

More examples using bricks_from_table() and bricks_from_coords() can be found at the links below.

  • Get started with the framework for building a brick from scratch.
  • Build an owl with bricks_from_table() by manually placing each brick.
  • Generate a punny random forest model using bricks_from_coords() and {purrr}.
You can’t perform that action at this time.