Skip to content

Commit

Permalink
Merge branch 'master' of github.com:stemangiola/tidySingleCellExperiment
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed Oct 5, 2021
2 parents 71e9a46 + 8bdcbd6 commit de34c9a
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions R/tidyr_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ NULL
#'
#'
#' @export
unnest.tidySingleCellExperiment_nested <- function(data, cols, ..., keep_empty=FALSE, ptype=NULL,
names_sep=NULL, names_repair="check_unique", .drop, .id, .sep, .preserve) {
unnest_single_cell_experiment <- function(data, cols, ..., keep_empty=FALSE, ptype=NULL,
names_sep=NULL, names_repair="check_unique", .drop, .id, .sep, .preserve) {
# Need this otherwise crashes map
.data_ <- data

Expand All @@ -75,16 +75,16 @@ unnest.tidySingleCellExperiment_nested <- function(data, cols, ..., keep_empty=F
is("SingleCellExperiment") %>%
any() ~

# Do my trick to unnest
mutate(., !!cols := imap(
!!cols, ~ .x %>%
bind_cols_(
# Do my trick to unnest
mutate(., !!cols := imap(
!!cols, ~ .x %>%
bind_cols_(

# Attach back the columns used for nesting
.data_ %>% select(-!!cols) %>% slice(rep(.y, nrow(as_tibble(.x))))
# Attach back the columns used for nesting
.data_ %>% select(-!!cols) %>% slice(rep(.y, nrow(as_tibble(.x))))

)
)) %>%
)
)) %>%
pull(!!cols) %>%
reduce(bind_rows),

Expand All @@ -96,6 +96,15 @@ unnest.tidySingleCellExperiment_nested <- function(data, cols, ..., keep_empty=F
)
}

#' @importFrom rlang quo_name
#' @importFrom purrr imap
#'
#'
#' @export
unnest.tidySingleCellExperiment_nested <- unnest_single_cell_experiment



#' nest
#'
#' @importFrom tidyr nest
Expand Down

0 comments on commit de34c9a

Please sign in to comment.