row_function: Apply Function per Row

View source: R/row_function.R

row_functionR Documentation

Apply Function per Row

Description

This can be used to e.g. add a maximum of certain rows.

Usage

row_function(fn, ..., data = NULL)

Arguments

fn

function to apply, such as max()

...

tidyverse selector helpers, passed on to select()

data

data set, will be determined with pick() if left blank

Examples

if (require("dplyr")) {
  iris |> 
    mutate(max = row_function(max, where(is.numeric)),
           sepal_mean = row_function(mean, starts_with("Sepal"))) |> 
    head()
}

certe-medical-epidemiology/certestats documentation built on Nov. 9, 2024, 8:15 p.m.