Patch for dplyr 1.0.0

This commit is contained in:
ryantimpe
2020-05-09 14:36:01 -04:00
parent 5f4816a097
commit d47715ed8e
8 changed files with 21 additions and 10 deletions
+1 -1
View File
@@ -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:
+2
View File
@@ -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.
-1
View File
@@ -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
View File
@@ -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

-1
View File
@@ -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
View File
@@ -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