Skip to content
Merged

Dev #35

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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