Skip to content

Commit

Permalink
fix problem with unnest by removing NA logical columns first
Browse files Browse the repository at this point in the history
to circumvent r-lib/vctrs#800
closes #91
  • Loading branch information
sebkopf committed Feb 9, 2020
1 parent d17dfde commit 18ffe63
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: isoreader
Title: Read IRMS data files
Description: R interface to IRMS (isotope ratio mass spectrometry) file formats typically used in stable isotope geochemistry.
Version: 1.0.14
Version: 1.0.15
Authors@R: person("Sebastian", "Kopf", email = "sebastian.kopf@colorado.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-2044-0201"))
URL: https://github.com/isoverse/isoreader
BugReports: https://github.com/isoverse/isoreader/issues
Expand Down
7 changes: 6 additions & 1 deletion R/file_info_operations.R
Expand Up @@ -589,7 +589,12 @@ iso_add_file_info.data.frame <- function(df, new_file_info, ..., quiet = default
)

# select data based on priority
final_data <- joined_data %>% select(..priority, data) %>% unnest(data) %>%
final_data <-
joined_data %>%
select(..priority, data) %>%
# avoid problems with the temp columns during unnest
mutate(data = map(data, ~select(.x, -starts_with("..ni_temp_")))) %>%
unnest(data) %>%
select(-starts_with("..ni_temp_")) %>%
group_by(..df_id) %>%
filter(..priority == max(..priority)) %>%
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-file-info-operations.R
Expand Up @@ -307,6 +307,14 @@ test_that("Test that file info addition works", {
"'file_id'\\+'y' join.*0/1 new info.*matched 0"
)

# sequential join including a logical column join
iso_add_file_info(
mutate(file_info, y = rep(c(TRUE, FALSE), each = 3)),
mutate(new_info, y = c(TRUE, FALSE, NA, NA, NA)),
by1 = "y",
by2 = "file_id"
)

# test with isofiles (not just in data frame)
template <- make_cf_data_structure("NA")
template$read_options$file_info <- TRUE
Expand Down

0 comments on commit 18ffe63

Please sign in to comment.