sprintf_single_value: Like 'sprintf()' but using the same value in each...

View source: R/data_manip_utils.R

sprintf_single_valueR Documentation

Like sprintf() but using the same value in each specification

Description

This is equivalent to calling sprintf() with value passed after fmt as many times as there are conversion specifications in fmt.

Usage

sprintf_single_value(fmt, value)

Arguments

fmt

This has the same meaning as in sprintf().

value

The single value use for every conversion specification in fmt.

Value

See sprintf().

Note that vector arguments are still recycled normally.

Examples


fmt <- "Hello %s. Your name is %s. Isn't it good to be named %s?"
# With normal sprintf, you need to specify the right number of
# arguments:
name <- c("John Doe", "Jane Doe")
sprintf(fmt, name, name, name)
# Instead, this figures out the right number of times to pass it:
sprintf_single_value(fmt, name)


DarwinAwardWinner/rctutils documentation built on July 22, 2022, 5:19 a.m.