@@ -99,12 +99,12 @@ add_cache_block <- function(pd_nested) {
9999shallowify <- function (pd ) {
100100 if (cache_is_activated()) {
101101 order <- order(pd $ line1 , pd $ col1 , - pd $ line2 , - pd $ col2 , as.integer(pd $ terminal ))
102- pd_parent_first <- pd [ order , ]
103- pos_ids_to_keep <- pd_parent_first % > %
104- split(cumsum( pd_parent_first $ parent == 0L )) %> %
102+ pd_parent_first <- vec_slice( pd , order )
103+ pd_parent_first_split <- vec_split( pd_parent_first , cumsum( pd_parent_first $ parent == 0L ))
104+ pos_ids_to_keep <- pd_parent_first_split [[ 2L ]] %> %
105105 map(find_pos_id_to_keep ) %> %
106106 unlist(use.names = FALSE )
107- shallow <- pd [ pd $ pos_id %in% pos_ids_to_keep , ]
107+ shallow <- vec_slice( pd , pd $ pos_id %in% pos_ids_to_keep )
108108 shallow $ terminal [shallow $ is_cached ] <- TRUE
109109 # all cached expressions need to be marked as terminals because to
110110 # [apply_stylerignore()], we rely on terminals only.
@@ -335,10 +335,9 @@ nest_parse_data <- function(pd_flat) {
335335 return (pd_flat )
336336 }
337337 pd_flat $ internal <- with(pd_flat , (id %in% parent ) | (parent < = 0L ))
338- split_data <- split(pd_flat , pd_flat $ internal )
339338
340- child <- split_data $ `FALSE`
341- internal <- split_data $ `TRUE`
339+ child <- vec_slice( pd_flat , ! pd_flat $ internal )
340+ internal <- vec_slice( pd_flat , pd_flat $ internal )
342341
343342 internal $ internal_child <- internal $ child
344343 internal $ child <- NULL
@@ -367,14 +366,14 @@ nest_parse_data <- function(pd_flat) {
367366# ' the correct order.
368367# ' @param child A parse table or `NULL`.
369368# ' @param internal_child A parse table or `NULL`.
370- # ' @details Essentially, this is a wrapper around [dplyr::bind_rows ()], but
371- # ' returns `NULL` if the result of [dplyr::bind_rows ()] is a data frame with
369+ # ' @details Essentially, this is a wrapper around vctrs::vec_rbind ()], but
370+ # ' returns `NULL` if the result of vctrs::vec_rbind ()] is a data frame with
372371# ' zero rows.
373372# ' @keywords internal
374373combine_children <- function (child , internal_child ) {
375- bound <- bind_rows (child , internal_child )
374+ bound <- vec_rbind (child , internal_child )
376375 if (nrow(bound ) == 0L ) {
377376 return (NULL )
378377 }
379- bound [ order(bound $ pos_id ), ]
378+ vec_slice( bound , order(bound $ pos_id ))
380379}
0 commit comments