From 6d8865faedafa2fe900ee8560105eadb506e4180 Mon Sep 17 00:00:00 2001 From: Rob Challen Date: Thu, 17 Nov 2022 20:12:50 +0000 Subject: [PATCH] 0.2.5 candidate --- DESCRIPTION | 2 +- NEWS.md | 12 ++++--- R/dtrackr.R | 41 +++++++++++++++------- docs/404.html | 2 +- docs/CONTRIBUTING.html | 2 +- docs/LICENSE-text.html | 2 +- docs/LICENSE.html | 2 +- docs/articles/consort-example.html | 6 ++-- docs/articles/dtrackr-options.html | 2 +- docs/articles/dtrackr.html | 6 ++-- docs/articles/index.html | 2 +- docs/articles/joining-pipelines.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 28 ++++++++------- docs/pkgdown.yml | 2 +- docs/reference/add_count.trackr_df.html | 2 +- docs/reference/add_tally.html | 2 +- docs/reference/anti_join.trackr_df.html | 2 +- docs/reference/arrange.trackr_df.html | 2 +- docs/reference/bind_cols.html | 2 +- docs/reference/bind_rows.html | 2 +- docs/reference/capture_exclusions.html | 2 +- docs/reference/comment.html | 2 +- docs/reference/count_subgroup.html | 2 +- docs/reference/distinct.trackr_df.html | 2 +- docs/reference/dot2svg.html | 2 +- docs/reference/exclude_all.html | 2 +- docs/reference/excluded.html | 2 +- docs/reference/filter.trackr_df.html | 2 +- docs/reference/flowchart.html | 5 +-- docs/reference/full_join.trackr_df.html | 2 +- docs/reference/group_by.trackr_df.html | 2 +- docs/reference/group_modify.trackr_df.html | 2 +- docs/reference/history.html | 2 +- docs/reference/include_any.html | 2 +- docs/reference/index.html | 2 +- docs/reference/inner_join.trackr_df.html | 2 +- docs/reference/intersect.trackr_df.html | 2 +- docs/reference/left_join.trackr_df.html | 2 +- docs/reference/mutate.trackr_df.html | 2 +- docs/reference/nest_join.trackr_df.html | 2 +- docs/reference/p_add_count.html | 2 +- docs/reference/p_add_tally.html | 2 +- docs/reference/p_anti_join.html | 2 +- docs/reference/p_arrange.html | 2 +- docs/reference/p_bind_cols.html | 2 +- docs/reference/p_bind_rows.html | 2 +- docs/reference/p_capture_exclusions.html | 2 +- docs/reference/p_clear.html | 2 +- docs/reference/p_comment.html | 2 +- docs/reference/p_copy.html | 2 +- docs/reference/p_count_if.html | 2 +- docs/reference/p_count_subgroup.html | 2 +- docs/reference/p_distinct.html | 2 +- docs/reference/p_exclude_all.html | 2 +- docs/reference/p_excluded.html | 2 +- docs/reference/p_filter.html | 2 +- docs/reference/p_flowchart.html | 5 +-- docs/reference/p_full_join.html | 2 +- docs/reference/p_get.html | 2 +- docs/reference/p_get_as_dot.html | 2 +- docs/reference/p_group_by.html | 2 +- docs/reference/p_group_modify.html | 2 +- docs/reference/p_include_any.html | 2 +- docs/reference/p_inner_join.html | 2 +- docs/reference/p_intersect.html | 2 +- docs/reference/p_left_join.html | 2 +- docs/reference/p_mutate.html | 2 +- docs/reference/p_nest_join.html | 2 +- docs/reference/p_pause.html | 2 +- docs/reference/p_pivot_longer.html | 2 +- docs/reference/p_pivot_wider.html | 2 +- docs/reference/p_relocate.html | 2 +- docs/reference/p_rename.html | 2 +- docs/reference/p_rename_with.html | 2 +- docs/reference/p_resume.html | 2 +- docs/reference/p_right_join.html | 2 +- docs/reference/p_select.html | 2 +- docs/reference/p_semi_join.html | 2 +- docs/reference/p_set.html | 2 +- docs/reference/p_setdiff.html | 2 +- docs/reference/p_slice.html | 2 +- docs/reference/p_slice_head.html | 2 +- docs/reference/p_slice_max.html | 2 +- docs/reference/p_slice_min.html | 2 +- docs/reference/p_slice_sample.html | 2 +- docs/reference/p_slice_tail.html | 2 +- docs/reference/p_status.html | 2 +- docs/reference/p_summarise.html | 2 +- docs/reference/p_tagged.html | 2 +- docs/reference/p_track.html | 2 +- docs/reference/p_transmute.html | 2 +- docs/reference/p_ungroup.html | 2 +- docs/reference/p_union.html | 2 +- docs/reference/p_union_all.html | 2 +- docs/reference/p_untrack.html | 2 +- docs/reference/pause.html | 2 +- docs/reference/pipe.html | 2 +- docs/reference/pivot_longer.trackr_df.html | 2 +- docs/reference/pivot_wider.trackr_df.html | 2 +- docs/reference/plot.trackr_graph.html | 2 +- docs/reference/print.trackr_graph.html | 2 +- docs/reference/reexports.html | 2 +- docs/reference/relocate.trackr_df.html | 2 +- docs/reference/rename.trackr_df.html | 2 +- docs/reference/rename_with.trackr_df.html | 2 +- docs/reference/resume.html | 2 +- docs/reference/right_join.trackr_df.html | 2 +- docs/reference/save_dot.html | 10 +++--- docs/reference/select.trackr_df.html | 2 +- docs/reference/semi_join.trackr_df.html | 2 +- docs/reference/setdiff.trackr_df.html | 2 +- docs/reference/slice.trackr_df.html | 2 +- docs/reference/slice_head.trackr_df.html | 2 +- docs/reference/slice_max.trackr_df.html | 2 +- docs/reference/slice_min.trackr_df.html | 2 +- docs/reference/slice_sample.trackr_df.html | 2 +- docs/reference/slice_tail.trackr_df.html | 2 +- docs/reference/status.html | 2 +- docs/reference/std_size.html | 2 +- docs/reference/summarise.trackr_df.html | 2 +- docs/reference/tagged.html | 2 +- docs/reference/track.html | 2 +- docs/reference/transmute.trackr_df.html | 2 +- docs/reference/ungroup.trackr_df.html | 2 +- docs/reference/union.trackr_df.html | 2 +- docs/reference/union_all.trackr_df.html | 2 +- docs/reference/untrack.html | 2 +- man/flowchart.Rd | 3 +- man/p_flowchart.Rd | 3 +- tests/testthat/test-github-issues.R | 27 ++++++++++++++ 132 files changed, 221 insertions(+), 167 deletions(-) create mode 100644 tests/testthat/test-github-issues.R diff --git a/DESCRIPTION b/DESCRIPTION index c69cceb..fd3ab9d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dtrackr Title: Track your Data Pipelines -Version: 0.2.4.9001 +Version: 0.2.5 Authors@R: person(given = "Robert", family = "Challen", diff --git a/NEWS.md b/NEWS.md index fac2131..8bde042 100644 --- a/NEWS.md +++ b/NEWS.md @@ -49,7 +49,6 @@ transmute, ungroup * Print and plot S3 methods for history graph. * Vignette fixes. * Non breaking changes to API so bumping to new minor version for CRAN submission. -* (Version to stay unstable until CRAN submission complete) # dtrackr 0.2.5 @@ -67,6 +66,11 @@ dtrackr Coverage: 83.60%, R/dot.R: 78.12%, R/dtrackr.R: 84.08%) mostly through examples * improved error handling and reporting in mutate functions. -* issues: documentation results in examples tests running multiple times. -* TODO: (next version) exclusions in joins. -* Logo. +* bug #25 & #26 fixes: +* Logo and documentation fixes. + +* issues: re-use of documentation results in examples tests running multiple times. +* TODO: (next version) exclusions in joins +* TODO: (next version) better support for long format tables +* TODO: (future version) column level tracking (prototyped in 0.2.5) + diff --git a/R/dtrackr.R b/R/dtrackr.R index 82169d1..77312a5 100644 --- a/R/dtrackr.R +++ b/R/dtrackr.R @@ -1166,12 +1166,22 @@ p_include_any = function(.data, ..., .headline=.defaultHeadline(), na.rm=TRUE, . for(filter in filters) { glueSpec = rlang::f_rhs(filter) filt = rlang::f_lhs(filter) - out = out %>% dplyr::group_modify(function(d,g,...) { - d %>% - dplyr::mutate(.incl = rlang::eval_tidy(filt,data = d, env=.env)) %>% + # out = out %>% dplyr::group_modify(function(d,g,...) { + # d %>% + # dplyr::mutate(.incl = rlang::eval_tidy(filt, data = d, env=.env)) %>% + # dplyr::mutate(.incl.na = ifelse(is.na(.incl),!na.rm,.incl)) %>% + # dplyr::mutate(.retain = .retain | .incl.na) + # }) + # Fix for github issue #26. I didn't want to do this in a group_modify as it loses the grouped + # columns (which I could have reassembled with the g parameter). Instead I am doing this + # in a standard mutate using the dplyr::cur_data_all. This behaviour is demonstrated here: + # iris %>% group_by(Species) %>% filter(rlang::eval_tidy( quo(Petal.Width==max(Petal.Width)), data = cur_data_all())) + # where the result should be 5 long with entries for each Species. + out = out %>% + dplyr::mutate(.incl = rlang::eval_tidy(filt, data = dplyr::cur_data_all(), env=.env)) %>% dplyr::mutate(.incl.na = ifelse(is.na(.incl),!na.rm,.incl)) %>% dplyr::mutate(.retain = .retain | .incl.na) - }) + tmp = out %>% dplyr::summarise( .count = dplyr::n(), @@ -1935,12 +1945,15 @@ p_setdiff = function(x, y, ..., .messages="{.count.out} items in difference", .h x = x %>% .untrack() y = y %>% .untrack() #.env = environment() - if (is.null(names(by))) { - .keys = paste0(by, collapse = ",") + if (is.null(by)) { + # Fix of #25 - the natural join when columns are not specified + .keys = paste0(intersect(colnames(x),colnames(y)), collapse = ", ") + } else if (is.null(names(by))) { + .keys = paste0(by, collapse = ", ") } else { .keys = paste0( ifelse(names(by) != "", paste(names(by),by,sep="="),by), - collapse="," + collapse=", " ) } .count.lhs = nrow(x) @@ -2165,7 +2178,8 @@ is_running_in_chunk = function() { #' together in which case an attempt is made to determine which parts are #' common. #' -#' @param .data the tracked dataframes +#' @param .data the tracked dataframe(s) either as a single dataframe or as a +#' list of dataframes. #' @param ... other params passed onto either `p_get_as_dot()`, notable ones are #' `fill` (background colour e.g. 'lightgrey'), `fontsize` (in points), #' `colour` (font colour) @@ -2190,18 +2204,21 @@ is_running_in_chunk = function() { #' tmp %>% group_by(Species) %>% comment(.tag="step2") %>% flowchart() p_flowchart = function(.data, filename = NULL, size = std_size$half, maxWidth = size$width, maxHeight = size$height, formats=c("dot","png","pdf","svg"), defaultToHTML = TRUE, ...) { - if("trackr_df" %in% class(.data)) .data = list(.data) + # make sure .data is a list of dataframes + if(is.data.frame(.data)) .data = list(.data) mergedGraph=.emptyGraph() + + if(!any(sapply(.data, .isTracked))) stop("None of the inputs is a tracked data frame. Did you forget to call dtrackr::track()") + if(!all(sapply(.data, .isTracked))) rlang::warn("Some of the inputs are not tracked data frames. These will be ignored.", .frequency = "always") + for(item in .data) { if ("trackr_df" %in% class(item)) { mergedGraph = .mergeGraphs(mergedGraph, item %>% p_get()) - } else { - rlang::warn(".data is not a tracked dataframe. Did you forget to call dtrackr::track()?", .frequency = "always") } } # if we are knitting and the output is not HTML we will need the image - # saved somewhere as a png and pdf.Also if output if github markdown + # saved somewhere as a png and pdf. Also if output if github markdown # Also if we are viewing the image in the console and the user requested the png if( (is_knitting() && !(knitr::is_html_output())) diff --git a/docs/404.html b/docs/404.html index 9dac19e..c7f961e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -39,7 +39,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index d7e7feb..3a52a03 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -17,7 +17,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 0bbb93e..de6fa49 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/LICENSE.html b/docs/LICENSE.html index f09cb56..4a69755 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -17,7 +17,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/articles/consort-example.html b/docs/articles/consort-example.html index 520cd88..29b34d0 100644 --- a/docs/articles/consort-example.html +++ b/docs/articles/consort-example.html @@ -40,7 +40,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 @@ -333,8 +333,8 @@

Tagging the pipeline= Sys.Date() # we could have included any number of other parameters here from the global environment ) %>% dplyr::pull(.label) -#> treat:placebo: 36/74 (48.6%) patients on 2022-11-04, with a mean height of 145.58 ± 29.10 -#> treat:rIFN-g: 38/74 (51.4%) patients on 2022-11-04, with a mean height of 143.14 ± 25.12 +#> treat:placebo: 36/74 (48.6%) patients on 2022-11-17, with a mean height of 145.58 ± 29.10 +#> treat:rIFN-g: 38/74 (51.4%) patients on 2022-11-17, with a mean height of 143.14 ± 25.12

Sometimes it will be necessary to operate on all tagged content at once. This is possible but be aware that the content available depends somewhat on where the tag was set in the pipeline so not all fields will diff --git a/docs/articles/dtrackr-options.html b/docs/articles/dtrackr-options.html index e71d4d8..e45b582 100644 --- a/docs/articles/dtrackr-options.html +++ b/docs/articles/dtrackr-options.html @@ -40,7 +40,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/articles/dtrackr.html b/docs/articles/dtrackr.html index 20dba98..6fb2f4f 100644 --- a/docs/articles/dtrackr.html +++ b/docs/articles/dtrackr.html @@ -40,7 +40,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 @@ -139,10 +139,10 @@

Tracking data provenance# devtools::load_all() library(tidyverse) #> ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── -#> ggplot2 3.3.6 purrr 0.3.4 +#> ggplot2 3.3.6 purrr 0.3.5 #> tibble 3.1.8 dplyr 1.0.10 #> tidyr 1.2.1 stringr 1.4.1 -#> readr 2.1.2 forcats 0.5.2 +#> readr 2.1.3 forcats 0.5.2 #> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── #> dplyr::filter() masks stats::filter() #> dplyr::lag() masks stats::lag() diff --git a/docs/articles/index.html b/docs/articles/index.html index 7914d78..c9fb7b3 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/articles/joining-pipelines.html b/docs/articles/joining-pipelines.html index 77b1df9..1d05eca 100644 --- a/docs/articles/joining-pipelines.html +++ b/docs/articles/joining-pipelines.html @@ -40,7 +40,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/authors.html b/docs/authors.html index ebb0a7b..92b14fc 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/index.html b/docs/index.html index b7b68c3..37095db 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 diff --git a/docs/news/index.html b/docs/news/index.html index 664aaae..ddd6720 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ dtrackr - 0.2.4.9001 + 0.2.5 @@ -110,21 +110,23 @@