utils: Utility functions

Utility functionsR Documentation

Utility functions

Description

get_metadata adds metadata to a list-like object.

outer_vec simply performs the cross-product, specifically x t(y), and assigns dimnames to the resulting matrix.

split_string inserts separator characters in a character string to truncate strings for printing.

vec.transform takes a vector and transforms it to have a new range, given the input, or the default values of [0, 1].

Usage

get_metadata(object)

outer_vec(x, y)

split_string(x, max_len = 80L, delim = "\\+", sep = "\n")

vec.transform(x, min.val = 0, max.val = 1)

Arguments

object

A list-like object

x

A character string

max_len

Integer; the max length of one line. Default: 80

delim

Character specifying where to end a line if it is longer than max_len. Default: '+'

sep

Character specifying what to split by. Default: '\n' (a newline character)

min.val

the minimum value of the new range

max.val

the maximum value of the new range

Details

If the object is a graph, graph-level attributes will be added. The elements added are:

version

A list with R, brainGraph, and igraph versions

sys

Character vector of system information

date

The date and time of creation

The delim argument determines where to insert the separator. For example, given the default, it will attempt to insert newline characters only following a plus sign.

Value

get_metadata - the same object with version, system, and date information added

A vector of the transformed input.


cwatson/brainGraph documentation built on Feb. 21, 2024, 6:33 p.m.