Skip to content

Commit 20fcdda

Browse files
committed
Update dplyr_methods.R
1 parent f54c934 commit 20fcdda

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/dplyr_methods.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,10 @@ slice_sample.SingleCellExperiment <- function(.data, ..., n=NULL,
546546
select(!!c_(.data)$symbol) %>%
547547
count(!!c_(.data)$symbol)
548548

549+
.max_cell_count <- ifelse(nrow(count_cells)==0, 0, max(count_cells$n))
550+
549551
# If repeated cells due to replacement
550-
if (count_cells$n |> max() |> gt(1)){
552+
if (.max_cell_count |> gt(1)){
551553
message("tidySingleCellExperiment says: When sampling with replacement",
552554
" a data frame is returned for independent data analysis.")
553555
.data |>

0 commit comments

Comments
 (0)