mirror of
https://github.com/ryantimpe/brickr.git
synced 2026-05-01 00:00:40 -05:00
Patch for dplyr 1.0.0
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ Suggests:
|
||||
raster,
|
||||
stringr
|
||||
Roxygen: list(markdown = TRUE)
|
||||
RoxygenNote: 7.0.2
|
||||
RoxygenNote: 7.1.0
|
||||
URL: https://github.com/ryantimpe/brickr
|
||||
BugReports: https://github.com/ryantimpe/brickr/issues
|
||||
Collate:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# brickr 0.3.4
|
||||
|
||||
* Error fixes for dplyr 1.0.0 release.
|
||||
|
||||
## Mosaics
|
||||
|
||||
* When uploading a png with a transparent background, those bricks will default to White. Change input 'trans_bg' to any LEGO color name.
|
||||
|
||||
@@ -254,7 +254,6 @@ bricks_from_table <- function(matrix_table, color_guide = brickr::lego_colors,
|
||||
#' @family 3D Models
|
||||
#' @export
|
||||
#' @examples
|
||||
#' #Demo table in same format as Excel template
|
||||
#' #This creates a 1x3 red brick.
|
||||
#'demo_excel <- tibble::tribble(
|
||||
#' ~Level, ~"1", ~"2", ~"3", ~user_color, ~LEGO_color,
|
||||
|
||||
+14
-5
@@ -77,11 +77,12 @@ collect_bricks <- function(image_list, use_bricks = NULL,
|
||||
dplyr::mutate(brick_type = paste0("x", xx, "y", yy, "_offx", offset_x, "_offy", offset_y)) %>%
|
||||
dplyr::mutate(brick_name = ifelse(length(unique(Lego_name)) == 1 & dplyr::n() == (xx*yy),
|
||||
paste0("brick_", "x", min(x), "_y", min(y), "_",
|
||||
Level, "_", mid_level, "_", piece_type), NA),
|
||||
Level, "_", mid_level, "_", piece_type), NA_character_),
|
||||
brick_area = xx*yy, brick_height = yy, brick_width = xx) %>%
|
||||
dplyr::ungroup() %>%
|
||||
dplyr::select(-xg, -yg) %>%
|
||||
dplyr::filter(!is.na(Lego_name))
|
||||
dplyr::filter(!is.na(Lego_name)) %>%
|
||||
as.data.frame()
|
||||
}
|
||||
)
|
||||
|
||||
@@ -92,10 +93,17 @@ collect_bricks <- function(image_list, use_bricks = NULL,
|
||||
dplyr::mutate(brick_name = paste0("brick_", "x", x, "_y", y, "_",
|
||||
Level, "_", mid_level, "_", piece_type),
|
||||
brick_area = 1, brick_height = 1, brick_width = 1) %>%
|
||||
dplyr::filter(!is.na(Lego_name))
|
||||
dplyr::filter(!is.na(Lego_name)) %>%
|
||||
as.data.frame()
|
||||
|
||||
#Combine multi- and single- bricks
|
||||
img <- dplyr::bind_rows(list(img_multi, img_single))
|
||||
if(nrow(img_multi) == 0){
|
||||
img <- img_single
|
||||
} else if(nrow(img_single) == 0){
|
||||
img <- img_multi
|
||||
} else{
|
||||
img <- dplyr::bind_rows(list(img_multi, img_single))
|
||||
}
|
||||
|
||||
#Output of all brick types... size * layout
|
||||
bricks <- unique(img$brick_type)
|
||||
@@ -116,7 +124,8 @@ collect_bricks <- function(image_list, use_bricks = NULL,
|
||||
dplyr::ungroup() %>%
|
||||
#Drop rows where the areas don't match
|
||||
dplyr::filter(area_act == brick_area) %>%
|
||||
dplyr::select(-dplyr::starts_with("area"))
|
||||
dplyr::select(-dplyr::starts_with("area")) %>%
|
||||
as.data.frame()
|
||||
|
||||
bricks_df <- bricks_df %>%
|
||||
dplyr::bind_rows(dat)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
@@ -55,7 +55,6 @@ A list with elements \code{Img_lego} to pass to \code{\link{build_bricks}}.
|
||||
Build a 3D model from an Excel template. A single data frame includes both the instructions and the color guides.
|
||||
}
|
||||
\examples{
|
||||
#Demo table in same format as Excel template
|
||||
#This creates a 1x3 red brick.
|
||||
demo_excel <- tibble::tribble(
|
||||
~Level, ~"1", ~"2", ~"3", ~user_color, ~LEGO_color,
|
||||
|
||||
+4
-2
@@ -4,7 +4,8 @@
|
||||
\name{lego_colors}
|
||||
\alias{lego_colors}
|
||||
\title{Brickr colors available for mosaics & 3D models}
|
||||
\format{A data frame with 54 rows and 10 variables:
|
||||
\format{
|
||||
A data frame with 54 rows and 10 variables:
|
||||
\describe{
|
||||
\item{brickrID}{integer, simple color number for use in mosaic creation}
|
||||
\item{Color}{color name}
|
||||
@@ -16,7 +17,8 @@
|
||||
\item{Trans_lego}{Transparent color, TRUE or FALSE}
|
||||
\item{hex}{Color hex code}
|
||||
\item{lum}{Color brightness, (0-1)}
|
||||
}}
|
||||
}
|
||||
}
|
||||
\source{
|
||||
\url{https://brickarchitect.com/color/}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
Reference in New Issue
Block a user