From c16abb7922f888ef67b3694f44164ce654bd0577 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 28 Jul 2024 12:27:06 +0200 Subject: [PATCH] beautify tables --- vignettes/tidyverse_translation.Rmd | 41 +++++++++++++++-------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/vignettes/tidyverse_translation.Rmd b/vignettes/tidyverse_translation.Rmd index 75a98c266..d2978ac28 100644 --- a/vignettes/tidyverse_translation.Rmd +++ b/vignettes/tidyverse_translation.Rmd @@ -33,9 +33,10 @@ if (all_deps_available) { can_vignette_be_evaluated <- all_deps_available && getRversion() >= "4.1.0" -# since we explicitly put `eval = TRUE` for some chunks, we can't rely on -# `knitr::opts_chunk$set(eval = FALSE)` at the beginning of the script. So we make -# a logical that is `FALSE` only if deps are not installed (cf easystats/easystats#317) +# Since we explicitly put `eval = TRUE` for some chunks, we can't rely on +# `knitr::opts_chunk$set(eval = FALSE)` at the beginning of the script. +# Therefore, we introduce a logical that is `FALSE` only if all suggested +# dependencies are not installed (cf easystats/easystats#317) if (can_vignette_be_evaluated) { evaluate_chunk <- TRUE } else { @@ -101,20 +102,20 @@ efc <- head(efc) Before we look at their *tidyverse* equivalents, we can first have a look at `{datawizard}`'s key functions for data wrangling: -| Function | Operation | -| :---------------- | :------------------------------------------------ | -| `data_filter()` | [to select only certain observations](#filtering) | -| `data_select()` | [to select only a few variables](#selecting) | -| `data_modify()` | [to create variables or modify existing ones](#modifying) | -| `data_arrange()` | [to sort observations](#sorting) | -| `data_extract()` | [to extract a single variable](#extracting) | -| `data_rename()` | [to rename variables](#renaming) | -| `data_relocate()` | [to reorder a data frame](#relocating) | -| `data_to_long()` | [to convert data from wide to long](#reshaping) | -| `data_to_wide()` | [to convert data from long to wide](#reshaping) | -| `data_join()` | [to join two data frames](#joining) | -| `data_unite()` | [to concatenate several columns into a single one](#uniting) | -| `data_separate()` | [to separate a single column into multiple columns](#separating) | +| Function | Operation | +| :---------------- | :--------------------------------------------------------------- | +| `data_filter()` | [to select only certain observations](#filtering) | +| `data_select()` | [to select only a few variables](#selecting) | +| `data_modify()` | [to create variables or modify existing ones](#modifying) | +| `data_arrange()` | [to sort observations](#sorting) | +| `data_extract()` | [to extract a single variable](#extracting) | +| `data_rename()` | [to rename variables](#renaming) | +| `data_relocate()` | [to reorder a data frame](#relocating) | +| `data_to_long()` | [to convert data from wide to long](#reshaping) | +| `data_to_wide()` | [to convert data from long to wide](#reshaping) | +| `data_join()` | [to join two data frames](#joining) | +| `data_unite()` | [to concatenate several columns into a single one](#uniting) | +| `data_separate()` | [to separate a single column into multiple columns](#separating) | Note that there are a few functions in `{datawizard}` that have no strict equivalent in `{dplyr}` or `{tidyr}` (e.g `data_rotate()`), and so we won't discuss them in @@ -128,7 +129,7 @@ Before we look at them individually, let's first have a look at the summary tabl | :---------------- | :------------------------------------------------------------------ | | `data_filter()` | `dplyr::filter()`, `dplyr::slice()` | | `data_select()` | `dplyr::select()` | -| `data_modify()` | `dplyr::mutate()` | +| `data_modify()` | `dplyr::mutate()` | | `data_arrange()` | `dplyr::arrange()` | | `data_extract()` | `dplyr::pull()` | | `data_rename()` | `dplyr::rename()` | @@ -138,8 +139,8 @@ Before we look at them individually, let's first have a look at the summary tabl | `data_join()` | `dplyr::inner_join()`, `dplyr::left_join()`, `dplyr::right_join()`, | | | `dplyr::full_join()`, `dplyr::anti_join()`, `dplyr::semi_join()` | | `data_peek()` | `dplyr::glimpse()` | -| `data_unite()` | `tidyr::unite()` | -| `data_separate()` | `tidyr::separate()` | +| `data_unite()` | `tidyr::unite()` | +| `data_separate()` | `tidyr::separate()` | ## Filtering {#filtering}