basics_help: Wrappers for 'base' functions

View source: R/basics.R

basics_helpR Documentation

Wrappers for base functions

Description

Wrappers for frequently used base package functions.

Usage

basics_help()

g(g, ...)

g0(...)

g1(...)

p(p, ...)

p0(...)

p1(...)

na(x)

ok(x)

wna(x)

wok(x)

null(x)

def(x)

lo(x)

hi(x)

len(x)

mid(x, start, stop)

spf(fmt, ...)

levs(x)

rounded(x)

clabs(x)

dlabs()

rlabs(x)

vlabs(x)

is_atm(x)

is_chr(x)

is_fac(x)

is_int(x)

is_lgl(x)

is_num(x)

is_ord(x)

is_uno(x)

not_atm(x)

not_chr(x)

not_fac(x)

not_int(x)

not_lgl(x)

not_num(x)

not_ord(x)

not_uno(x)

is_arr(x)

is_dtf(x)

is_fun(x)

is_lst(x)

is_mat(x)

is_vec(x)

not_arr(x)

not_dtf(x)

not_fun(x)

not_lst(x)

not_mat(x)

not_vec(x)

x_in(x, ...)

x_mf(x, ...)

Details

Basic function wrappers not related to counts/lengths

  g paste0(av(...), collapse = g) (glues ...)
  p paste(..., sep = p)
  g0 paste0(av(...), collapse = "")
  p0 paste(..., sep = "")
  g1 paste0(av(...), collapse = " ")
  p1 paste(..., sep = " ")
   
  hi ceiling(x)
  lo floor(x)
   
  na is.na(x)
  ok !is.na(x)
   
  wna which(na(x))
  wok which(ok(x))
   
  len nchar(x)
   
  mid substr(.)
   
  spf sprintf(.)
   
  levs levels(x)
   
  none !any(av(...))
   
  x_in x[isIN(x, ...)]
  x_mf x[isMF(x, ...)]
   
  clabs colnames(x)
  dlabs ...names(x)
  elabs names(x)
  rlabs   rownames
   
  ⁠is_arr, not_arr⁠   ⁠(!)is.array(x)⁠
  ⁠is_dtf, not_dtf⁠ ⁠(!)is.data.frame(x)⁠
  ⁠is_fun, not_fun⁠ ⁠(!)is.function(x)⁠
  ⁠is_lst, not_lst⁠ ⁠(!)is.list(x)⁠
  ⁠is_mat, not_mat⁠ ⁠(!)is.matrix(x)⁠
  ⁠is_vec, not_veq⁠ ⁠(!)is.vector(x)⁠
   
  ⁠is_atm, not_atm⁠ ⁠(!)is.atomic(x)⁠
  ⁠is_chr, not_chr⁠ ⁠(!)is.character(x)⁠
  ⁠is_fac, not_fac⁠ ⁠(!)is.factor(x)⁠
  ⁠is_int, not_int⁠ ⁠(!)is.integer(x)⁠
  ⁠is_lgl, not_lgl⁠ ⁠(!)is.logical(x)⁠
  ⁠is_num, not_num⁠ ⁠(!)is.numeric(x)⁠
  ⁠is_ord, not_ord⁠ ⁠(!)is.ordered(x)⁠
  ⁠is_uno, not_uno⁠ ⁠(!)is_fac(x) & (!)is_ord(x)⁠
   

Functions

  • g(): Calls paste0(av(...), collapse = g).

  • g0(): Calls paste0(av(...), collapse = "").

  • g1(): Calls paste0(av(...), collapse = " ").

  • p(): Calls paste0(..., sep = p).

  • p0(): Calls paste0(...).

  • p1(): Calls paste(..., sep = " ").

  • na(): A thin wrapper for is.na

  • ok(): A thin wrapper for !is.na

  • wna(): Evaluates which values of x are NA.

  • wok(): Evaluates which values of x are OK (i.e., not NA).

  • null(): Evaluates whether x is NULL.

  • def(): Evaluates whether x is defined (i.e., not NULL).

  • lo(): A thin wrapper for floor

  • hi(): A thin wrapper for ceiling

  • len(): A thin wrapper for nchar

  • mid(): A thin wrapper for substr

  • spf(): A thin wrapper for sprintf.

  • levs(): Gets the levels (ordered, unordered factor) x.

  • rounded(): Evaluates whether x is rounded to the nearest integer.

  • clabs(): Gets names of columns of x.

  • dlabs(): Gets names of dots (...).

  • rlabs(): Gets names of the rows of x.

  • vlabs(): Gets names of the values of x.

  • is_atm(): Evaluates whether x is of atomic mode.

  • is_chr(): Evaluates whether x is of mode character.

  • is_fac(): Evaluates whether x is of mode factor.

  • is_int(): Evaluates whether x is of mode integer.

  • is_lgl(): Evaluates whether x is of mode logical

  • is_num(): Evaluates whether x is of mode numeric.

  • is_ord(): Evaluates whether x is of mode ordered factor.

  • is_uno(): Evaluates whether x is of mode unordered factor.

  • not_atm(): Evaluates whether x is not atomic.

  • not_chr(): Evaluates whether x is not of mode character

  • not_fac(): Evaluates whether x is not of mode factor.

  • not_int(): Evaluates whether x is not of mode integer.

  • not_lgl(): Evaluates whether x is not of mode logical.

  • not_num(): Evaluates whether x is not of mode numeric.

  • not_ord(): Evaluates whether x is not of mode ordered factor.

  • not_uno(): Evaluates whether x is not of mode unordered factor.

  • is_arr(): Evaluates whether x is an array.

  • is_dtf(): Evaluates whether x is a data.frame.

  • is_fun(): Evaluates whether x is a function.

  • is_lst(): Evaluates whether x is a list.

  • is_mat(): Evaluates whether x is a matrix.

  • is_vec(): Evaluates whether x is a vector.

  • not_arr(): Evaluates whether x is not an array

  • not_dtf(): Evaluates whether x is not a data.frame.

  • not_fun(): Evaluates whether x is not a function.

  • not_lst(): Evaluates whether x is not a list.

  • not_mat(): Evaluates whether x is not a matrix.

  • not_vec(): Evaluates whether x is not a vector.

  • x_in(): Evaluates whether elements of x are contained in the atomic elements of ....

  • x_mf(): Evaluates whether elements of x are missing from the atomic elements of ....

See Also

Other wraps: dp(), dt(), gg_help(), gr, rd_help(), tb_help()

Examples

vals <- c(1:3, 2:4) / 3
vars <- c("a", "bb", "ccc", "dddd", "ccc", "bb")
text <- "%s = %0.2f and %s = %0.0f"
vals
vars
text
lo(vals)
hi(vals)
len(vars)
mid(vars, 1, 3)
spf(text, vars[1:3], vals[1:3], vars[4:6], vals[4:6])
### more examples ###

j-martineau/uj documentation built on Sept. 14, 2024, 4:40 a.m.