From 7b60f8bbfb7cf7b1046f0536e47c086748197248 Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 15:22:45 +0200 Subject: [PATCH 01/14] Add **labelled** to README --- README.Rmd | 1 + 1 file changed, 1 insertion(+) diff --git a/README.Rmd b/README.Rmd index 10da084..da3825b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -94,6 +94,7 @@ This will reduce the time it takes for us to review your contribution. Thank you This project is related to other existing projects in R or other languages, but also differs from them in the following aspects: +- [labelled](https://github.com/larmarange/labelled/): A package for labelling data in R, but it is more focused on labelling variables than validating them. - [linelist](https://github.com/epiverse-trace/linelist): A package for managing and validating linelist data - the original inspiration for datatagr. ### Code of Conduct From 8ede11e651fd050675570e1ba907f5ecfa5652fb Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 15:24:50 +0200 Subject: [PATCH 02/14] Reorder instructions --- README.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.Rmd b/README.Rmd index da3825b..abafcde 100644 --- a/README.Rmd +++ b/README.Rmd @@ -76,8 +76,8 @@ To make it easier for us to evaluate your contribution, please run the following ```r styler::style_pkg() -spelling::update_wordlist(pkg = ".", vignettes = TRUE) devtools::document() +spelling::update_wordlist(pkg = ".", vignettes = TRUE) lintr::lint_package() From 1c1507aaad7c836e5f7b5c38ce3e41c7338d0e05 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 1 Oct 2024 13:27:26 +0000 Subject: [PATCH 03/14] Automatic readme update --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f0ce4d..830ac2a 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,8 @@ is consistent with the rest of the package: ``` r styler::style_pkg() -spelling::update_wordlist(pkg = ".", vignettes = TRUE) devtools::document() +spelling::update_wordlist(pkg = ".", vignettes = TRUE) lintr::lint_package() @@ -100,6 +100,9 @@ Thank you! 😊 This project is related to other existing projects in R or other languages, but also differs from them in the following aspects: +- [labelled](https://github.com/larmarange/labelled/): A package for + labelling data in R, but it is more focused on labelling variables + than validating them. - [linelist](https://github.com/epiverse-trace/linelist): A package for managing and validating linelist data - the original inspiration for datatagr. From ccf2fc458bd82ad220025229d9148ccf07da604a Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 15:36:34 +0200 Subject: [PATCH 04/14] Consistent printing --- R/print.datatagr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.datatagr.R b/R/print.datatagr.R index 54d2a66..5d917f6 100644 --- a/R/print.datatagr.R +++ b/R/print.datatagr.R @@ -38,7 +38,7 @@ print.datatagr <- function(x, ...) { label_names <- names(label_values) # Construct the labels_txt string from the filtered pairs - labels_txt <- paste(label_names, label_values, sep = "-", collapse = ", ") + labels_txt <- paste(label_names, label_values, sep = " - ", collapse = ", ") if (labels_txt == "") { labels_txt <- "[no labelled variables]" From dfe86b06b6e4b53cf342df3d3292140a10536422 Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:14:40 +0200 Subject: [PATCH 05/14] Make printing more readable --- R/lost_labels.R | 6 +----- R/print.datatagr.R | 7 ++++--- R/restore_labels.R | 6 +----- R/vars_labels.R | 11 +++++++++++ man/vars_labels.Rd | 16 ++++++++++++++++ tests/testthat/_snaps/compat-dplyr.md | 3 ++- tests/testthat/_snaps/print.md | 6 ++++-- tests/testthat/test-square_bracket.R | 2 +- 8 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 R/vars_labels.R create mode 100644 man/vars_labels.Rd diff --git a/R/lost_labels.R b/R/lost_labels.R index 40faac3..bfd657a 100644 --- a/R/lost_labels.R +++ b/R/lost_labels.R @@ -16,11 +16,7 @@ lost_labels <- function(old, new, lost_action) { if (lost_action != "none" && length(lost_vars) > 0) { lost_labels <- lapply(lost_vars, function(label) old[[label]]) - lost_msg <- paste(lost_vars, - lost_labels, - sep = " - ", - collapse = ", " - ) + lost_msg <- vars_labels(lost_vars, lost_labels) msg <- paste( "The following labelled variables are lost:\n", lost_msg diff --git a/R/print.datatagr.R b/R/print.datatagr.R index 5d917f6..277f1fb 100644 --- a/R/print.datatagr.R +++ b/R/print.datatagr.R @@ -38,12 +38,13 @@ print.datatagr <- function(x, ...) { label_names <- names(label_values) # Construct the labels_txt string from the filtered pairs - labels_txt <- paste(label_names, label_values, sep = " - ", collapse = ", ") + labels_txt <- vars_labels(label_names, label_values) if (labels_txt == "") { - labels_txt <- "[no labelled variables]" + cat("\n[no labelled variables]\n") + } else { + cat("\nlabelled variables:\n", labels_txt, "\n") } - cat("\nlabels:", labels_txt, "\n") invisible(x) } diff --git a/R/restore_labels.R b/R/restore_labels.R index 2c98e61..961a2ef 100644 --- a/R/restore_labels.R +++ b/R/restore_labels.R @@ -38,11 +38,7 @@ restore_labels <- function(x, newLabels, if (lost_action != "none" && length(lost_vars) > 0) { lost_labels <- lapply(lost_vars, function(label) newLabels[[label]]) - lost_msg <- paste(lost_vars, - lost_labels, - sep = " - ", - collapse = ", " - ) + lost_msg <- vars_labels(lost_vars, lost_labels) msg <- paste( "The following labelled variables are lost:\n", lost_msg diff --git a/R/vars_labels.R b/R/vars_labels.R new file mode 100644 index 0000000..c4c3a50 --- /dev/null +++ b/R/vars_labels.R @@ -0,0 +1,11 @@ +#' Internal printing function for variables and labels +#' +#' @param vars a `character` vector of variable names +#' @param labels a `character` vector of labels +vars_labels <- function(vars, labels) { + paste(vars, + labels, + sep = " - ", + collapse = "\n " + ) +} diff --git a/man/vars_labels.Rd b/man/vars_labels.Rd new file mode 100644 index 0000000..ede85f7 --- /dev/null +++ b/man/vars_labels.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/vars_labels.R +\name{vars_labels} +\alias{vars_labels} +\title{Internal printing function for variables and labels} +\usage{ +vars_labels(vars, labels) +} +\arguments{ +\item{vars}{a \code{character} vector of variable names} + +\item{labels}{a \code{character} vector of labels} +} +\description{ +Internal printing function for variables and labels +} diff --git a/tests/testthat/_snaps/compat-dplyr.md b/tests/testthat/_snaps/compat-dplyr.md index 069554c..b1217f8 100644 --- a/tests/testthat/_snaps/compat-dplyr.md +++ b/tests/testthat/_snaps/compat-dplyr.md @@ -1,7 +1,8 @@ # Compatibility with dplyr::transmute() The following labelled variables are lost: - speed - Miles per hour, dist - Distance in miles + speed - Miles per hour + dist - Distance in miles # Compatibility with dplyr::mutate(.keep) diff --git a/tests/testthat/_snaps/print.md b/tests/testthat/_snaps/print.md index 951b73a..649505f 100644 --- a/tests/testthat/_snaps/print.md +++ b/tests/testthat/_snaps/print.md @@ -54,7 +54,9 @@ 49 24 120 50 25 85 - labels: speed-Miles per hour, dist-Distance in miles + labelled variables: + speed - Miles per hour + dist - Distance in miles --- @@ -112,5 +114,5 @@ 49 24 120 50 25 85 - labels: [no labelled variables] + [no labelled variables] diff --git a/tests/testthat/test-square_bracket.R b/tests/testthat/test-square_bracket.R index 4087f57..8a953f0 100644 --- a/tests/testthat/test-square_bracket.R +++ b/tests/testthat/test-square_bracket.R @@ -14,7 +14,7 @@ test_that("tests for [ operator", { expect_error(x[, 1], msg) lost_labels_action("warning", quiet = TRUE) - msg <- "The following labelled variables are lost:\n speed - Miles per hour, dist - Distance in miles" + msg <- "The following labelled variables are lost:\n speed - Miles per hour\n dist - Distance in miles" expect_warning(x[, NULL], msg) # functionalities From 3bcd6487018826b13a49dfd844d1c61bd126335b Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:18:30 +0200 Subject: [PATCH 06/14] Update `Authors@R` --- DESCRIPTION | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index de418a8..f9123b1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,10 @@ Package: datatagr Title: Generic Data Labelling and Validating Version: 0.0.1 Authors@R: c( - person("Chris", "Hartgerink", , "chris@data.org", role = "cre", + person("Chris", "Hartgerink", , "chris@data.org", role = c("cre", "aut"), comment = c(ORCID = "0000-0003-1050-6809")) + person("Hugo", "Gruson", , "hugo@data.org", role = "rev", + comment = c(ORCID = "0000-0002-4094-1476")) ) Description: Provides tools to help label and validate data according to user-specified rules. The 'datatagr' class adds variable level attributes to 'data.frame' columns. Once labelled, these variables can be seamlessly used in downstream analyses, making data pipelines clearer, more robust, and more reliable. License: MIT + file LICENSE From aeef7fcd62851349191c36d223a301f74c3cbc9e Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:20:04 +0200 Subject: [PATCH 07/14] Simplify checkmate --- R/validate_types.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/validate_types.R b/R/validate_types.R index 11d8011..91a4ac2 100644 --- a/R/validate_types.R +++ b/R/validate_types.R @@ -37,8 +37,7 @@ validate_types <- function(x, ...) { checkmate::assert_class(x, "datatagr") types <- rlang::list2(...) - checkmate::assert_list(types, min.len = 1) - checkmate::assert_list(types, types = "character") + checkmate::assert_list(types, min.len = 1, types = "character") vars_to_check <- intersect(names(x), names(types)) From 9f6bc52d822160b4d0c51ef9102e6e67f4393dc5 Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:21:19 +0200 Subject: [PATCH 08/14] Rename remove_label.r to remove_label.R --- R/{remove_label.r => remove_label.R} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename R/{remove_label.r => remove_label.R} (100%) diff --git a/R/remove_label.r b/R/remove_label.R similarity index 100% rename from R/remove_label.r rename to R/remove_label.R From d5d157dbc8272962479811e8c916935530a6eeda Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:23:00 +0200 Subject: [PATCH 09/14] Fix DESCRIPTION --- DESCRIPTION | 2 +- man/datatagr-package.Rd | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f9123b1..aec951e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Title: Generic Data Labelling and Validating Version: 0.0.1 Authors@R: c( person("Chris", "Hartgerink", , "chris@data.org", role = c("cre", "aut"), - comment = c(ORCID = "0000-0003-1050-6809")) + comment = c(ORCID = "0000-0003-1050-6809")), person("Hugo", "Gruson", , "hugo@data.org", role = "rev", comment = c(ORCID = "0000-0002-4094-1476")) ) diff --git a/man/datatagr-package.Rd b/man/datatagr-package.Rd index 6db368b..ef97005 100644 --- a/man/datatagr-package.Rd +++ b/man/datatagr-package.Rd @@ -122,5 +122,10 @@ Useful links: \author{ \strong{Maintainer}: Chris Hartgerink \email{chris@data.org} (\href{https://orcid.org/0000-0003-1050-6809}{ORCID}) +Other contributors: +\itemize{ + \item Hugo Gruson \email{hugo@data.org} (\href{https://orcid.org/0000-0002-4094-1476}{ORCID}) [reviewer] +} + } \keyword{internal} From 781fbb72484a43cc3620fa736a1bf0242987b6ea Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:28:30 +0200 Subject: [PATCH 10/14] Update reference to package --- R/datatagr-package.R | 2 +- man/datatagr-package.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/datatagr-package.R b/R/datatagr-package.R index 9e910bd..0e1dfa1 100644 --- a/R/datatagr-package.R +++ b/R/datatagr-package.R @@ -1,6 +1,6 @@ #' Base Tools for Labelling and Validating Data #' -#' The *datatagr* package provides tools to help label and validate data. The +#' The \pkg{datatagr} package provides tools to help label and validate data. The #' 'datatagr' class adds column level attributes to a 'data.frame'. #' Once labelled, variables can be seamlessly used in downstream analyses, #' making data pipelines more robust and reliable. diff --git a/man/datatagr-package.Rd b/man/datatagr-package.Rd index ef97005..141f49c 100644 --- a/man/datatagr-package.Rd +++ b/man/datatagr-package.Rd @@ -6,7 +6,7 @@ \alias{datatagr} \title{Base Tools for Labelling and Validating Data} \description{ -The \emph{datatagr} package provides tools to help label and validate data. The +The \pkg{datatagr} package provides tools to help label and validate data. The 'datatagr' class adds column level attributes to a 'data.frame'. Once labelled, variables can be seamlessly used in downstream analyses, making data pipelines more robust and reliable. From 772228bdaad86356ec7e33d5faaa055675e690ad Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Tue, 1 Oct 2024 16:29:28 +0200 Subject: [PATCH 11/14] Be more precise in comment --- R/validate_labels.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/validate_labels.R b/R/validate_labels.R index 55e7c4a..bfc4014 100644 --- a/R/validate_labels.R +++ b/R/validate_labels.R @@ -37,7 +37,7 @@ validate_labels <- function(x) { if (is.null(unlist(x_labels))) stop("`x` has no labels") - # check that x is a list, and each label is a `character` + # check that x_labels is a list, and each label is a `character` checkmate::assert_list(x_labels, types = c("character", "null")) x From 5e307cae3eee9523adfc3dbb5c70d8bef3ad055b Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Wed, 2 Oct 2024 14:33:42 +0200 Subject: [PATCH 12/14] Add comment for `ifelse` --- R/datatagr-package.R | 4 ++-- R/label_variables.R | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/datatagr-package.R b/R/datatagr-package.R index 0e1dfa1..132a917 100644 --- a/R/datatagr-package.R +++ b/R/datatagr-package.R @@ -1,7 +1,7 @@ #' Base Tools for Labelling and Validating Data #' -#' The \pkg{datatagr} package provides tools to help label and validate data. The -#' 'datatagr' class adds column level attributes to a 'data.frame'. +#' The \pkg{datatagr} package provides tools to help label and validate data. +#' The 'datatagr' class adds column level attributes to a 'data.frame'. #' Once labelled, variables can be seamlessly used in downstream analyses, #' making data pipelines more robust and reliable. #' diff --git a/R/label_variables.R b/R/label_variables.R index 62f4b1c..6e6168e 100644 --- a/R/label_variables.R +++ b/R/label_variables.R @@ -39,6 +39,10 @@ label_variables <- function(x, labels) { for (name in names(labels)) { label_value <- unlist(labels[names(labels) == name]) + # We use the `label` attribute to store the label + # We use `ifelse` to handle the case where the label is set to `NULL` + # This is because `as.character(NULL)` returns `character(0)` + # attr(x[[name]], "label") <- NULL does not have the desired result attr(x[[name]], "label") <- ifelse(is.null(label_value), "", as.character(label_value) From f7deb16b4b151a980413241e5d0ddca3b691e566 Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Wed, 2 Oct 2024 14:37:07 +0200 Subject: [PATCH 13/14] Remove redundant code --- R/labels_df.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/labels_df.R b/R/labels_df.R index e7fd32e..55ed49c 100644 --- a/R/labels_df.R +++ b/R/labels_df.R @@ -25,10 +25,8 @@ labels_df <- function(x) { labels <- unlist(labels(x)) out <- drop_datatagr(x) - # Find the intersection of names(out) and names(labels) - common_names <- intersect(names(out), names(labels)) # Replace the names of out that are in intersection with corresponding labels - names(out)[match(common_names, names(out))] <- labels[common_names] + names(out)[match(names(labels), names(out))] <- labels[names(labels)] out } From cc751b5c3ebea8f9061c1aac2f05b7f4a84e7694 Mon Sep 17 00:00:00 2001 From: Chris Hartgerink Date: Wed, 2 Oct 2024 14:53:08 +0200 Subject: [PATCH 14/14] Copy `linelist/vignettes/compat-dplyr.Rmd` --- inst/WORDLIST | 5 + man/datatagr-package.Rd | 4 +- vignettes/compat-dplyr.Rmd | 220 +++++++++++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+), 2 deletions(-) create mode 100644 vignettes/compat-dplyr.Rmd diff --git a/inst/WORDLIST b/inst/WORDLIST index 9c2214f..cfbfcd0 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -6,7 +6,12 @@ ORCID RECON Unlabeled dplyr +leverspeed lifecycle linelist +messspeeds rlang +tibble tidyselect +tidyverse +unclassing diff --git a/man/datatagr-package.Rd b/man/datatagr-package.Rd index 141f49c..6ff3b1a 100644 --- a/man/datatagr-package.Rd +++ b/man/datatagr-package.Rd @@ -6,8 +6,8 @@ \alias{datatagr} \title{Base Tools for Labelling and Validating Data} \description{ -The \pkg{datatagr} package provides tools to help label and validate data. The -'datatagr' class adds column level attributes to a 'data.frame'. +The \pkg{datatagr} package provides tools to help label and validate data. +The 'datatagr' class adds column level attributes to a 'data.frame'. Once labelled, variables can be seamlessly used in downstream analyses, making data pipelines more robust and reliable. } diff --git a/vignettes/compat-dplyr.Rmd b/vignettes/compat-dplyr.Rmd new file mode 100644 index 0000000..fb93c38 --- /dev/null +++ b/vignettes/compat-dplyr.Rmd @@ -0,0 +1,220 @@ +--- +title: "Compatibility with dplyr" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Compatibility with dplyr} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +**datatagr** philosophy is to prevent you from accidentally losing valuable data, but to otherwise be totally transparent and not to interfere with your workflow. + +One popular ecosystem for data science workflow is the **tidyverse**. We try to ensure decent datatagr compatibility with the tidyverse. All dplyr verbs are tested in the `tests/test-compat-dplyr.R` file. + +```{r} +library(datatagr) +library(dplyr) + +x <- make_datatagr( + cars, + speed = "Miles per hour", + dist = "Distance in miles" +) + +head(x) +``` + +## Verbs operating on rows + +datatagr does not modify anything regarding the behaviour for row-operations. As such, it is fully compatible with dplyr verbs operating on rows out-of-the-box. +You can see in the following examples that datatagr does not produce any errors, warnings or messspeeds and its labels are conserved through dplyr operations on rows. + +### `dplyr::arrange()` ✅ + +```{r} +x %>% + arrange(speed) %>% + head() +``` + +### `dplyr:distinct()` ✅ + +```{r} +x %>% + distinct() %>% + head() +``` + +### `dplyr::filter()` ✅ + +```{r} +x %>% + filter(speed >= 50) %>% + head() +``` + +### `dplyr::slice()` ✅ + +```{r} +x %>% + slice(5:10) + +x %>% + slice_head(n = 5) + +x %>% + slice_tail(n = 5) + +x %>% + slice_min(speed, n = 3) + +x %>% + slice_max(speed, n = 3) + +x %>% + slice_sample(n = 5) +``` + +## Verbs operating on columns + +During operations on columns, datatagr will: + +- stay invisible and conserve labels if no labelled column is affected by the operation +- trigger `lost_labels_action()` if labelled columns are affected by the operation + +### `dplyr::mutate()` ✓ (partial) + +There is an incomplete compatibility with `dplyr::mutate()` in that simple renames without any actual modification of the column don't update the labels. In this scenario, users should rather use `dplyr::rename()` + +Although `dplyr::mutate()` is not able to leverspeed to full power of datatagr labels, datatagr objects behave as expected the same way a data.frame would: + +```{r} +# In place modification doesn't lose labels +x %>% + mutate(speed = speed + 10) %>% + head() + +# New columns don't affect existing labels +x %>% + mutate(ticket = speed >= 50) %>% + head() + +# .keep = "unused" generate expected tag loss conditions +x %>% + mutate(edad = speed, .keep = "unused") %>% + head() +``` + +### `dplyr::pull()` ✅ + +`dplyr::pull()` returns a vector, which results, as expected, in the loss of the datatagr class and labels: + +```{r} +x %>% + pull(speed) +``` + +### `dplyr::relocate()` ✅ + +```{r} +x %>% + relocate(speed, .before = 1) %>% + head() +``` + + +### `dplyr::rename()` & `dplyr::rename_with()` ✅ + +`dplyr::rename()` is fully compatible out-of-the-box with datatagr, meaning that labels will be updated at the same time that columns are renamed. This is possibly because it uses `names<-()` under the hood, which datatagr provides a custom `names<-.datatagr()` method for: + +```{r} +x %>% + rename(edad = speed) %>% + head() + +x %>% + rename_with(toupper) %>% + head() +``` + +### `dplyr::select()` ✅ + +`dplyr::select()` is fully compatible with datatagr, including when columns are renamed in a `select()`: + +```{r} +# Works fine +x %>% + select(speed, dist) %>% + head() + +# labels are updated! +x %>% + select(dist, edad = speed) %>% + head() +``` + +## Verbs operating on groups ✘ + +Groups are not yet supported. Applying any verb operating on group to a datatagr will silently convert it back to a data.frame or tibble. + +## Verbs operating on data.frames + +### `dplyr::bind_rows()` ✅ + +```{r} +dim(x) + +dim(bind_rows(x, x)) +``` + +### `dplyr::bind_cols()` ✘ + +`bind_cols()` is currently incompatible with datatagr: + +- labels from the second element are lost +- Warnings are produced about lost labels, even for labels that are not actually lost + +```{r} +bind_cols( + suppressWarnings(select(x, speed)), + suppressWarnings(select(x, dist)) +) %>% + head() +``` + +### Joins ✘ + +Joins are currently not compatible with datatagr as labels from the second element are silently dropped. + +```{r} +full_join( + suppressWarnings(select(x, speed, dist)), + suppressWarnings(select(x, dist, speed)) +) %>% + head() +``` + +## Verbs operating on multiple columns + +### `dplyr::pick()` ✘ + +`pick()` makes tidyselect functions work in usually tidyselect-incompatible functions, such as: + +```{r} +x %>% + dplyr::arrange(dplyr::pick(ends_with("loc"))) %>% + head() +``` + +As such, we could expect it to work with datatagr custom tidyselect-like function: `has_label()` but it's not the case since `pick()` currently strips out all attributes, including the `datatagr` class and all labels. +This unclassing is documented in `?pick`: + +> `pick()` returns a data frame containing the selected columns for the current group. +