Skip to content

Commit

Permalink
Rename benchmark to benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
courtiol committed Oct 27, 2023
1 parent 8f4a705 commit 8799992
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions R/lay.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' frame (`.data`) as the vector input of some function(s) `.fn`.
#'
#' This makes the creation of new columns based on a rowwise operation both simple (see
#' **Examples**; below) and efficient (see the vignette [**benchmarks**](../doc/benchmark.html)).
#' **Examples**; below) and efficient (see the Article [**benchmarks**](https://courtiol.github.io/lay/articles/benchmarks.html)).
#'
#' The function should be fully compatible with `{dplyr}`-based workflows and follows a syntax close
#' to [dplyr::across()].
Expand Down Expand Up @@ -49,7 +49,7 @@
#' - "tidy", internally uses [purrr::pmap()] and is stricter with respect to class coercion
#' across columns.
#'
#' The default has been chosen based on these [**benchmarks**](../doc/benchmark.html).
#' The default has been chosen based on these [**benchmarks**](https://courtiol.github.io/lay/articles/benchmarks.html).
#'
#' @importFrom vctrs vec_c
#' @importFrom rlang list2 exec as_function
Expand Down
4 changes: 2 additions & 2 deletions man/lay.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vignettes/articles/alternatives.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Alternatives to `lay()`"
title: "Alternatives for rowwise jobs"
---

```{r, include = FALSE}
Expand All @@ -12,13 +12,13 @@ knitr::opts_chunk$set(
## Article overview

There are many alternatives to perform rowwise jobs in R.
In this article, we consider, in turns, these alternatives.
In this Article, we consider, in turns, these alternatives.
We will stick to our example about drugs usage shown in [introduction](https://courtiol.github.io/lay/).
The idea is to compare alternative ways to create a new variable named `everused` which indicates if each respondent has used any of the considered pain relievers for non medical purpose or not.

## Loading packages

This article requires you to load the following packages:
This Article requires you to load the following packages:

```{r load_pkg, message=FALSE}
library(lay) ## for lay() and the data
Expand Down Expand Up @@ -150,6 +150,6 @@ There are probably other ways. If you think of a nice one, please leave an issue

## Efficiency

The results of a benchmark comparing alternative implementations for our simple rowwise job are shown in another article (see [benchmark](https://courtiol.github.io/lay/articles/benchmark.html)).
The results of benchmarks comparing alternative implementations for our simple rowwise job are shown in another Article (see [benchmarks](https://courtiol.github.io/lay/articles/benchmarks.html)).
As you will see, `lay()` is not just simple and powerful, it is also quite efficient!

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Benchmarking alternative implementations for rowwise jobs"
title: "Benchmarks"
---

```{r, include = FALSE}
Expand All @@ -11,7 +11,7 @@ knitr::opts_chunk$set(

## Article overview

The goal of this article is to compare the performances of `lay()` to alternatives described [here](https://courtiol.github.io/lay/articles/alternatives.html).
The goal of this Article is to compare the performances of `lay()` to alternatives described [here](https://courtiol.github.io/lay/articles/alternatives.html).
As you will see, the code using `lay()` is quite efficient.
The only alternative that is clearly more efficient is the one labeled below "*vectorized*".
Unfortunately, such a vectorized approach imply to refer explicitly to all column names which data are used.
Expand All @@ -21,7 +21,7 @@ and arithmetic operators and does allow the use of other types of functions.

## Loading packages

This article requires you to load the following packages:
This Article requires you to load the following packages:

```{r load_pkg, message=FALSE}
library(lay) ## for lay() and the data
Expand All @@ -30,8 +30,8 @@ library(tidyr) ## for pivot_longer() and pivot_wider()
library(purrr) ## for pmap_lgl()
library(slider) ## for slide()
library(data.table) ## for an alternative to base and dplyr
library(bench) ## for running the benchmark
library(forcats) ## for sorting levels in benchmark plot with fct_reorder()
library(bench) ## for running the benchmarks
library(forcats) ## for sorting levels in plot with fct_reorder()
```

Please install them if they are not present on your system.
Expand All @@ -55,9 +55,9 @@ drugs_full |>
pivot_wider(names_from = used, values_from = n)
```

In this article, we compare the efficiency of alternative ways to create a new variable named `everused` which indicates if each respondent has used any of the considered pain relievers for non medical purpose or not.
In this Article, we compare the efficiency of alternative ways to create a new variable named `everused` which indicates if each respondent has used any of the considered pain relievers for non medical purpose or not.

## Benchmark
## Benchmarks

Let's compare the running time of different methods to do this job:

Expand Down Expand Up @@ -189,7 +189,7 @@ benchmark2 |>

Note again that the x-axis of the plot is on a logarithmic scale.

## Benchmark environment
## Benchmarks' environment

```{r session}
sessionInfo()
Expand Down

0 comments on commit 8799992

Please sign in to comment.