funchir-utils: Miscellaneous utile functions

funchir-utilsR Documentation

Miscellaneous utile functions

Description

Several odds-and-ends functions for data manipulation & representation, etc. See details and examples.

Usage

   stale_package_check(con)
   embed.mat(mat, M = nrow(mat), N = ncol(mat), m = 1L, n = 1L, fill = 0L)
   quick_year(dates)
   quick_mday(dates)
   quick_yday(dates)

Arguments

con

A file/connection where output should be written.

mat

A matrix.

M

An integer specifying the number of rows in the enclosing matrix.

N

An integer specifying the number of columns in the enclosing matrix.

m

An integer specifying the row at which to insert mat.

n

An integer specifying the column at which to insert mat.

fill

An atomic vector specifying how to fill the enclosing matrix.

dates

A vector of Dates.

Value

stale_package_check DEPRECATED in favor of lintr::unused_import_linter.

embed.mat inserts a supplied matrix into a (weakly) larger enclosing matrix, typically filled with 0s, at a specified position.

quick_year converts a Date object into its year efficiently; also ignores concerns of leap centuries. quick_mday returns the day of the month. quick_yday returns the day of the year. Returns as an integer.

Examples

  inmat <- matrix(1:9, ncol = 3L)
  embed.mat(inmat, M = 4L, N = 4L)
  embed.mat(inmat, N = 6L, n = 4L, fill = NA)

  d1 = as.Date('1987-05-02')
  d2 = as.Date('2016-02-23')
  quick_year(d1)
  quick_mday(d1)

MichaelChirico/funchir documentation built on Jan. 21, 2025, 8:45 a.m.