paste_with_error: Combine two vectors into a single vector with a separator

View source: R/paste_with_error.R

paste_with_errorR Documentation

Combine two vectors into a single vector with a separator

Description

Used to create tables for publication, where values are presented with their errors The function will also deal with NAs, omitting the sep and error if error is NA or returning a blank string the whole output if value is NA

Usage

paste_with_error(value, error, sep = " ± ", digits = 2)

Arguments

value

Numerical vector of value of a variable

error

Numerical vector of error assocciated with variable

sep

Separator for value and error values. Defaults to ±

digits

Number of digits to numbers to. Defaults to 2

Examples

# This table makes to sense, but it shows how the function works
library(dplyr)
mutate(cars, example = paste_with_error(speed, dist))


MarcioFCMartins/MMartins documentation built on April 12, 2025, 12:50 a.m.