Learn R Programming

⚠️There's a newer version (0.6.11) of this package.Take me there.

matsbyname

The R package matsbyname enables matrix mathematics wherein operations are performed “by name” and row and column types are allowed.

Installation

You can install matsbyname from CRAN with:

install.packages("matsbyname")

You can install a recent development version of matsbyname from github with:

# install devtools if not already installed
# install.packages("devtools")
devtools::install_github("MatthewHeun/matsbyname")
# To build vignettes locally, use
devtools::install_github("MatthewHeun/matsbyname", build_vignettes = TRUE)

History

The functions in this package were used in Heun et al. (2018).

More Information

Find more information, including vignettes and function documentation, at https://MatthewHeun.github.io/matsbyname/.

References

Heun, Matthew Kuperus, Anne Owen, and Paul E. Brockway. 2018. “A Physical Supply-Use Table Framework for Energy Analysis on the Energy Conversion Chain.” Applied Energy 226 (September): 1134–62. https://doi.org/10.1016/j.apenergy.2018.05.109.

Copy Link

Version

Install

install.packages('matsbyname')

Monthly Downloads

560

Version

0.6.4

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Matthew Heun

Last Published

August 18th, 2023

Functions in matsbyname (0.6.4)

binaryapply_byname

Apply a binary function "by name"
coltype

Column type
colprods_byname

Column products, sorted by name
compare_byname

Compare matrix entries to a value
count_vals_incols_byname

Count the number of matrix entries in columns that meet a criterion
colsums_byname

Column sums, sorted by name
count_vals_byname

Count the number of matrix entries that meet a criterion
complete_and_sort

Complete matrices relative to one another and sort into same row, column order
clean_byname

Clean (delete) rows or columns of matrices that contain exclusively clean_value
complete_rows_cols

Complete rows and columns in one matrix relative to another
create_colvec_byname

Create column vectors from data
cumprod_byname

Cumulative element-product that respects row and column names
.data

Data pronoun
create_rowvec_byname

Create row vectors from data
create_matrix_byname

Create a "byname" matrix from a vector
count_vals_inrows_byname

Count the number of matrix entries in rows that meet a criterion
difference_byname

Name-wise subtraction of matrices
cumsum_byname

Cumulative sum that respects row and column names
cumapply_byname

Apply a function cumulatively to a list of matrices or numbers
eigenvalues_byname

Calculate eigenvalues of a matrix
exp_byname

Exponential of matrix elements
geometricmean_byname

Name- and element-wise geometric mean of two matrices.
eigenvectors_byname

Calculate eigenvectors of a matrix
equal_byname

Compare two matrices "by name" for equality
fractionize_byname

Compute fractions of matrix entries
getrownames_byname

Gets row names
elementapply_byname

Apply a function to an element of a matrix specified by rows and columns
getzerorowcolnames_byname

Names of zero rows and columns
hadamardproduct_byname

Name-wise matrix Hadamard multiplication
getcolnames_byname

Gets column names
identical_byname

Compare two matrices "by name" for exact equality
is_matrix_or_Matrix

Tells whether an object is one of a matrix or a Matrix
hatinv_byname

Hatize and invert a vector
hatize_byname

Creates a diagonal "hat" matrix from a vector
logarithmicmean_byname

Name- and element-wise logarithmic mean of matrices
log_byname

Logarithm of matrix elements
matrixproduct_byname

Name-wise matrix multiplication
matricize_byname

Matricize a vector
kvec_from_template_byname

Create a constant vector from matrix a
mean_byname

Name- and element-wise arithmetic mean of matrices
list_of_rows_or_cols

Named list of rows or columns of matrices
iszero_byname

Test whether this is the zero matrix
naryapply_byname

Apply a function "by name" to any number of operands
matsbyname-package

matsbyname: An Implementation of Matrix Mathematics
ncol_byname

Get the number of columns in a "byname" matrix.
invert_byname

Invert a matrix
is.Matrix

Is an object a Matrix?
prep_vector_arg

Prepare a vector argument
naryapplylogical_byname

Apply a function logically to numbers, matrices, or lists of numbers or matrices
pow_byname

Powers of matrix elements
rename_to_piece_byname

Rename matrix rows and columns by piece of row or column names
rename_to_pref_suff_byname

Rename matrix rows and columns by prefix and suffix
organize_args

Organize binary arguments
%>%

Pipe operator
rowprods_byname

Row products, sorted by name
replaceNaN_byname

Replace NaN values with a value
samestructure_byname

Test whether matrices or lists of matrices have same structure
select_cols_byname

Select columns of a matrix (or list of matrices) by name
select_rowcol_piece_byname

Select or remove rows or columns based on pieces of the names.
logmean

Logarithmic mean of two numbers
prepare_.FUNdots

Prepare the .FUNdots argument for *apply_byname functions.
identize_byname

Named identity matrix or vector
margin_from_types_byname

Translate row and column types to integer margins
prodall_byname

Product of all elements in a matrix
select_rows_byname

Select (or de-select) rows of a matrix (or list of matrices) by name
sort_rows_cols

Sorts rows and columns of a matrix
setcolnames_byname

Sets column names
sum_byname

Name-wise addition of matrices
:=

Assignment
svd_byname

Calculate the singular value decomposition of a matrix
nrow_byname

Get the number of rows in a "byname" matrix.
sumall_byname

Sum of all elements in a matrix
switch_notation_byname

Change row and column name notation
rowtype

Row type
unaryapply_byname

Apply a unary function by name
rowsums_byname

Row sums, sorted by name
trim_rows_cols

Trim rows and/or columns from a matrix
quotient_byname

Name-wise matrix element division
setcoltype

Sets column type for a matrix or a list of matrices
transpose_byname

Transpose a matrix by name
setrowtype

Sets row type for a matrix or a list of matrices
setrownames_byname

Sets row names
selectzerorows_byname

Select zero rows
vec_from_store_byname

Create a vector with labels from a matrix and values from a vector store
selectzerocols_byname

Select zero columns
vectorize_byname

Vectorize a matrix
aggregate_byname

Aggregate rows and columns in a matrix
Iminus_byname

Subtract a matrix with named rows and columns from a suitably named and sized identity matrix (I)
aggregation_map_helpers

Aggregation map conversions
and_byname

And "by name"
all_byname

Are all matrix elements TRUE?
Matrix

Create a Matrix amenable to use in the matsbyname package
abs_byname

Absolute value of matrix elements
any_byname

Are any matrix elements TRUE?
aggregate_to_pref_suff_byname

Aggregate a matrix to prefixes or suffixes of row and/or column names
aggregate_pieces_byname

Aggregate a matrix by pieces of row and/or column names