Formatting pin

Share:

Description

Format pin for pretty printing

Usage

1
format_pin(x, format. = "%Y%m%d%N", ...)

Arguments

x

vector of class "pin" (see as.pin) or a vector that can be coerced to such

format.

character string specifying the output format. %N is used as a reference for the last four digits of the pin. Format of the date is handled via strptime. ("%Y%m%d%N" by default). %P is an available shorthand for "(%C) %y-%m-%d - %N", a format aimed for maximal readability when used in long lists

...

arguments passed to format.Date

Value

character vector of same length as x

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
x <- as.pin(fake_pins$pin[1:10])

# Separate elements with hyphens:
format_pin(x, "%Y-%m-%d-%N")


# Separate even further
format_pin(x, "%C-%y-%m-%d-%N")

# The special P-format for maximal readability
format_pin(x, "%P") 

# A custom representation
format_pin(x, "Borned %d of %B in %Y (a %A in week %U) with suffix no: %N")

# Extract only the year
format_pin(x, "%Y")