LEGO Mosaics in R
This repository contains templates and examples to help user get started using the package!
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
# 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")
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
penguin <- readxl::read_xlsx("brickr_StarterKit.xlsx", sheet = "Set_Penguin") penguin %>% bricks_from_excel() %>% build_bricks(theta = 155, phi = 10) rayshader::render_snapshot()
Please feel free to contribute your own examples into any of the “Examples_” folders by submitting a pull request!
More examples using
be found at the links below.