set_values: Set multiple values useing one function call

Description Usage Arguments Value Examples

View source: R/set.R

Description

This functions allows to set multiple elements of a matrix instead of using annoying step-by-step assignment by mat[1,2] <- 2 mat[2,3] <- 0.5 etc.

Usage

1
2
3
set_values(mat, ...)

sv(mat, ...)

Arguments

mat

a matrix object

...

formulae; left hand values should be two-element interger vectors and right-hand: a single-value numeric

Value

matrix

Examples

1
2
mat <- matrix(0, 4, 5)
set_values(mat, c(1,1) ~ 5, c(3, 4) ~ 0.3)

matricks documentation built on March 26, 2020, 6:22 p.m.