xlHelpers: Tiny helpers

Description Usage Arguments Details Examples

Description

One Liner helper functions.

Usage

1
2
3
4
5
6
7
8
xlTxtDate(date = Sys.Date(), date_format = "%Y%m%d")

xlPct(num, digits = 2, num_format = "f", ...)

xlAddCommas(num, big.mark = ",", num_format = "d",
  preserve.width = "none", ...)

xlSQLIn(in_values)

Arguments

date

A date vector to be formated, default Sys.Date() for today's date.

date_format

A format string for date, default %Y%m%d yielding e.g. 20171231.

num

Numeric vector, to be transformed into string vector of various formats.

digits

Integer for the number of digits after decimal places in xlPct function.

num_format

Single length string for numerical conversion format in xlPct and xlAddCommas.

...

Additional arguments passed to xlPct, xlAddCommas etc..

big.mark

the symbol for separating digits, using ',' as the default.

preserve.width

parameters for xlAddCommas for saving additional spaces for output string.

in_values

A vector of any kind, to be transformed into a string separated by commas for an 'in statement' as part of a SQL query.

Details

These functions typically take various types of vectors and return transformed vectors / strings with specific formats that are common in day to day daa manipulations.

Examples

1
2
3
4
xlTxtDate()
xlPct(0.83)
xlAddCommas(93976)
xlSQLIn(c('Display', 'Organic'))

xinye1/xltools documentation built on Dec. 2, 2020, 7:23 p.m.