format_pin {sweidnumbr}R Documentation

Formatting pin

Description

Format pin for pretty printing

Usage

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

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")

[Package sweidnumbr version 1.5.0 Index]