Skip to content

Commit

Permalink
fixed bug caused by automatic unnesting
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgfalk committed Feb 9, 2024
1 parent 804f2d6 commit accc270
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Imports:
rlang (>= 0.4.11),
stringr,
tibble,
tidyr,
vctrs
Suggests:
covr,
igraph,
roxygen2,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
tidyr
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# wikkitidy (development version)

* `tidyr` moved from Imports to Suggests
* Automatic unnesting, introduced in 0.1.8, removed. It was causing bugs in certain edge cases, when nested data frames duplicated columns from the enclosing data frame. Unnesting is now left to the user, as shown in the examples.

# wikkitidy 0.1.11

* Live API calls removed from test suite on CRAN; these are still tested in the package's CI pipeline.
Expand Down
5 changes: 0 additions & 5 deletions R/perform-query.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,5 @@ result_to_query_tbl <- function(result) {
dplyr::where(rlang::is_list),
\(col) purrr::map(col, robust_bind)
))
result$x <- tidyr::unnest(
result$x,
dplyr::where(comprises_one_row_tibbles),
keep_empty = TRUE
)
rlang::inject(new_query_tbl(!!!result))
}
4 changes: 0 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,3 @@ flatten_bind <- function(response) {
response <- purrr::map(response, purrr::list_flatten)
robust_bind(response)
}

comprises_one_row_tibbles <- function(col) {
rlang::is_list(col) && all(purrr::map_lgl(col, \(row) nrow(row) <= 1))
}

0 comments on commit accc270

Please sign in to comment.