Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions R/compat-dplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ arrange_pos_id <- function(data) {

bind_rows <- function(x, y = NULL, ...) {
if (is.null(x) && is.null(y)) {
return(new_tibble(list(), nrow = 0))
return(new_tibble(list()))
}
if (is.null(x)) {
if (inherits(y, "data.frame")) {
Expand Down Expand Up @@ -62,7 +62,7 @@ left_join <- function(x, y, by) {

res <- merge(x, y, by.x = by_x, by.y = by_y, all.x = TRUE, sort = FALSE) %>%
arrange_pos_id()
res <- new_tibble(res, nrow = nrow(res))
res <- new_tibble(res)
# dplyr::left_join set unknown list columns to NULL, merge sets them
# to NA
if (exists("child", res) && anyNA(res$child)) {
Expand Down
2 changes: 1 addition & 1 deletion R/compat-tidyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ nest_ <- function(data, key_col, nest_cols = character()) {
res <- list()
res[[key_column]] <- key_levels
res[[key_col]] <- split(data[, nest_cols], key_factor)
new_tibble(res, nrow = length(key_levels))
new_tibble(res)
}
6 changes: 2 additions & 4 deletions R/nest.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ add_terminal_token_after <- function(pd_flat) {
list(
pos_id = terminals$pos_id,
token_after = lead(terminals$token, default = "")
),
nrow = nrow(terminals)
)
)

left_join(pd_flat, rhs, by = "pos_id")
Expand All @@ -271,8 +270,7 @@ add_terminal_token_before <- function(pd_flat) {
list(
id = terminals$id,
token_before = lag(terminals$token, default = "")
),
nrow = nrow(terminals)
)
)

left_join(pd_flat, rhs, by = "id")
Expand Down
5 changes: 2 additions & 3 deletions R/token-create.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ create_tokens <- function(tokens,
stylerignore = stylerignore,
block = block,
is_cached = is_cached
),
nrow = len_text
)
)
}

Expand All @@ -78,7 +77,7 @@ create_tokens <- function(tokens,
#' create one. The validation is done with [validate_new_pos_ids()]
#' @family token creators
#' @keywords internal
create_pos_ids <- function(pd, pos, by = 0.1, after = FALSE, n = 1) {
create_pos_ids <- function(pd, pos, by = 0.1, after = FALSE, n = 1L) {
direction <- ifelse(after, 1L, -1L)
first <- find_start_pos_id(pd, pos, by, direction, after)
new_ids <- seq(first,
Expand Down
2 changes: 1 addition & 1 deletion R/transform-files.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ transform_files <- function(files,
)
communicate_summary(changed, max_char)
communicate_warning(changed, transformers)
new_tibble(list(file = files, changed = changed), nrow = len_files)
new_tibble(list(file = files, changed = changed))
}

#' Transform a file and output a customized message
Expand Down
2 changes: 1 addition & 1 deletion man/create_pos_ids.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.